Mastodon — Office 365 SMTP Setup

Tyler Fleming
2 min readDec 19, 2022

Let’s start you off with the configuration items you’d need, I’m using docker-compose to run my mastodon instance so this is why it’s formatted as such.

SMTP Parameters

The thing that kept catching me here was the SMTP_AUTH_METHOD, which MUST be set to login instead of plain.

- SMTP_SERVER=smtp.office365.com
- SMTP_PORT=587
- SMTP_LOGIN=<email>
- SMTP_PASSWORD=<password>
- SMTP_FROM_ADDRESS=<email/from address>
- SMTP_ENABLE_STARTTLS_AUTO=true
- SMTP_AUTH_METHOD=login
- SMTP_OPENSSL_VERIFY_MODE=none
- SMTP_DELIVERY_METHOD=smtp
- SMTP_DOMAIN=<email domain>

Office 365 — Exchange Online Setup

I liked the idea of having a no-reply address in my already existing Office 365 tenant that I wouldn’t have to pay for. It DOES require that you have a licensed user account on the tenant that can be used for authentication but I will go over the steps.

  1. If you want to have your mastodon domain in use with Office 365 you will need to add the domain in the Office 365 Admin Center.
  2. Once that domain is added you can then use the domain within Exchange Online for email address (in this case a shared mailbox).
  3. Go to the Exchange Admin Center → Create a shared mailbox by click “Add a Shared Mailbox”
  4. You will want to go into the settings of this mailbox and give the licensed account send as permissions as this mailbox. CAUTION: THIS DOES EXPOSE YOUR EMAIL in the email headers of the no reply emails.
  5. Once the mailbox is created you will want to ensure you give whatever account you are using to authenticate SMTP with send as permissions on the mailbox.
  1. You will then need to enable SMTP authentication for your organization, this is found under settings → Mail Flow.
  1. To make this truly a no-reply mailbox you will want to now create a mail rule, the specifics of what exactly you would want to have happen if someone DID reply to the email is up to you, but here is mine as an example. Which is found under Mail Flow → Rules

--

--

Tyler Fleming

Follow me via Mastodon, @venivv@s.thecybernetwork.us