OAuth Outgoing Mail

Development Status
Stable
Active Installs
Maintainers
Download

Last updated: 2026-02-17

Works with CiviCRM 6.2 or higher.

Email Delivery Services

Use OAuth for authenticating for outgoing mail (smtp). Makes it possible to send email using your organization's Microsoft Office 365 or Google addresses.

This extension is developed so the Green European Journal could send e-mails through with their office 365 e-mail address. In theory it should work with Google or any other provider.

It may not be suitable for sending bulk emails. Outlook 365 has a daily limit of 10,000 recipients and sending too many bulk emails can trigger spam filters and lock your account.

Configuration

  1. Enable the OAuth Outgoing Mail extension (this extension)
  2. Configure an OAuth provider under Administer > System Settings > OAuth (see full documentation here)
  3. Set Outgoing mail to SMTP under Administer > System Settings > Outgoing mail. Enter an smtp server and port. Set authentication to no.
  4. Configure outgoing mail addresses. Go to Administer > CiviMail > Site From Mail Address
  5. Click on Add email address > Your OAuth provider.
  6. Login with the desired email address at your OAuth provider.

This extension depends on the "OAuth client" extension, which is part of CiviCRM and will be enabled automatically.

When using another provider than Google or Microsoft.

When you use another provider than Google or Microsoft your can provide the OAuth settings in the directory: [private]/your-provider.json. The contents of the file should look something like:

{
  "name": "example",
  "title": "Example",
  "options": {
    "urlAuthorize": "https://example.com/two",
    "scopes": ["scope-2-foo", "scope-2-bar"]
  },
 "mailSettingsTemplate": {
   "smtp": {
         "from_name": "{{access_token.name}}",
         "from_email": "{{token.resource_owner.email}}",
         "server": "smtp.office365.com",
         "port": "587",
         "username": "{{token.resource_owner.email}}"
    }
  }
}