gmailSaslXoauth2 function

SmtpServer gmailSaslXoauth2(
  1. String userEmail,
  2. String accessToken
)

Send through gmail with SASL XOAUTH2 authentication.

This requires an accessToken for userEmail with the OAuth2 scope: https://mail.google.com/.

Implementation

SmtpServer gmailSaslXoauth2(
  String userEmail,
  String accessToken,
) =>
    SmtpServer(
      'smtp.gmail.com',
      xoauth2Token: _formatXoauth2Token(userEmail, accessToken),
      ssl: true,
      port: 465,
    );