kaisellgren/mailer

How to check if this sending is successful?

Closed this issue · 1 comments

I don't see any method like SendReport.isSuccess.
How do I check this result whether this mail was sent?

final SendReport sendReport = await send(message, smtpServer);

Or when this sending failed. This function will throw an error and I can check it by using a try/catch like this.

try {
        final SendReport sendReport = await send(message, smtpServer);
        return true;
      }catch(e){
        return false;
      }

You will only get a SendReport if the message was sent successfully.

  try {
    final sendReport = await send(message, smtpServer);
    print('Message sent: ' + sendReport.toString());
  } on MailerException catch (e) {
    print('Message not sent.');
    for (var p in e.problems) {
      print('Problem: ${p.code}: ${p.msg}');
    }
  }