requestReadReceipt method
Requests a read receipt
This is done by setting the Disposition-Notification-To
header to from address.
Optionally specify a recipient address when no message sender
is defined in the from field yet.
Compare removeReadReceiptRequest Compare setHeader
Implementation
void requestReadReceipt({MailAddress? recipient}) {
final from = this.from;
recipient ??= (from != null && from.isNotEmpty) ? from.first : null;
if (recipient == null) {
throw InvalidArgumentException(
'Either define a sender in from or specify the recipient parameter',
);
}
setHeader(MailConventions.headerDispositionNotificationTo, recipient.email);
}