requestReadReceipt method
Requests a read receipt 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
Implementation
void requestReadReceipt({MailAddress? recipient}) {
recipient ??= (from?.isNotEmpty ?? false) ? from!.first : null;
if (recipient == null) {
throw StateError(
'Either define a sender in from or specify the recipient parameter');
}
setHeader(MailConventions.headerDispositionNotificationTo, recipient.email);
}