Gmail and Microsoft 365
OAuth vs app passwords for Gmail and Microsoft 365
By mailers.io team Published 5 min read
public/media/blog-oauth-vs-app-passwords-cover.webp Connecting a mailbox for sending means giving another service the power to send mail as you. There are two ways to do it: OAuth and an app password. They look similar when you set them up, and they are not the same thing. This post explains the difference, what it means for your risk and which one mailers.io uses where.
What each one is
An app password is a generated password that works for one purpose, such as signing in to your mailbox over SMTP or IMAP from a program that cannot show a Google or Microsoft sign-in page. You make it in your account settings, you copy it once and you paste it into the program. Google requires 2-Step Verification before it will make one. The program stores it and uses it every time, as it would your normal password.
OAuth is a sign-in handled by the provider. You are sent to Google or Microsoft, you sign in there, and a page lists what the program asks for. If you agree, the provider gives the program a token. The program never sees your password. The token carries only the permissions you approved, and it can be cancelled from your account without changing your password.
The practical differences
- Scope. An app password usually opens the whole mailbox for the protocol it is made for: send, read, and often delete. An OAuth grant can be limited. Gmail’s connection in mailers.io asks only for permission to send mail, plus basic identity so the app can check the mailbox’s domain. It does not ask to read your mailbox.
- Revocation. You can delete an app password or remove an OAuth grant. Both stop the program. With OAuth, the provider also shows you which apps hold access and what they can do, which makes an old connection easy to find.
- Exposure. A leaked app password can be used by anyone, from anywhere, until you revoke it. A leaked OAuth token is also dangerous, but it is limited to its permissions, expires and is refreshed in a controlled way. mailers.io stores mailbox credentials and tokens encrypted at rest.
- Admin control. A Microsoft 365 or Google Workspace admin can restrict third-party apps and see who has approved what. App passwords are far harder for an organisation to manage, and many organisations switch them off.
- Longevity. App passwords last until deleted. OAuth tokens can stop working for reasons outside your control, which is the price of that control.
When OAuth tokens stop working
A connection can fail even if you did nothing wrong. Google’s refresh tokens can be invalidated when the user revokes access, after a long time unused, or when the user changes their Google password, among other causes. Microsoft has its own rules, and an administrator can withdraw consent for an app for the whole organisation.
When that happens, the next send gets a refusal. mailers.io disables the server at once, so it does not keep trying, and the server’s page says that access was revoked. You can then press Reconnect, confirm with your password, and go through the provider’s consent again. After that you turn the server back on. If your account is set up with a route that includes another server, mail moves to that server meanwhile, which is one more reason not to send everything through one mailbox. See single points of failure.
Where mailers.io uses each method
- Gmail and Microsoft 365 as a sending server: OAuth. You choose Gmail or Microsoft 365 when adding a server, go to the provider to approve and return. Gmail mail is sent through the Gmail API. Microsoft mail is sent through Microsoft’s Graph interface. Neither uses SMTP with a password.
- Generic SMTP server: a username and password. If a provider offers SMTP and you connect it as a plain SMTP server, you enter what the provider gives you. That can be an app password. It is your choice and your responsibility, and it can stop working when the provider changes its rules. Microsoft has announced that password sign-in for SMTP is being phased out, so check before you rely on it.
- Reply and bounce mailboxes: an app password over IMAP. To detect replies or read bounce reports, mailers.io signs in to a mailbox over IMAP. A Gmail mailbox for this needs an app password, and the screen gives a hint to that effect. For replies, mailers.io reads only the header fields of messages, never the bodies, and it does not change or delete anything in the mailbox. For how replies stop a sequence, see sequence stops on reply.
That split follows from what each side allows. Sending can use a narrow OAuth permission. Reading replies would need a broader permission that mailers.io does not ask for, so it uses a separate mailbox login for that.
Limits do not change
Using OAuth does not give a mailbox more room. Gmail and Microsoft 365 apply their own sending limits to the mailbox however it is connected. For Google Workspace accounts, the commonly stated limit is 2,000 messages a day, and 500 for trial accounts, and an account over the limit can be blocked for up to a day. Microsoft has per-minute and per-organisation limits as well. Set the daily and speed limits on the server in mailers.io a little under those numbers. See daily limits per mailbox and server and rotating senders across mailboxes.
Mailboxes are also not the best tool for bulk mail. A mailbox is for conversations. For large campaigns, a sending service built for it, such as Amazon SES, SendGrid or Brevo, gives you more room and better bounce data, and you can keep the mailbox for the one-to-one messages of a sequence.
Which should you choose?
- Choose OAuth whenever the provider offers it for what you are doing. It is narrower, easier to revoke and does not put a mailbox password in another system.
- Use an app password only when OAuth is not available, such as a reply mailbox over IMAP, and make a separate one for each purpose so you can revoke one without affecting another.
- Never reuse your main password anywhere you could use a generated credential.
- Write down what you connected. A note of which mailbox is connected where, and why, makes a clean-up easy later.
A short security routine
- Turn on two-step verification on every mailbox you connect.
- Connect with OAuth, not a password, for sending.
- Review the apps that have access to your Google or Microsoft account each quarter, and remove the ones you do not recognise.
- After a staff member leaves, remove the connections they made and reconnect them under an account you control.
- If you suspect a leak, revoke the grant at the provider first, then delete the server in mailers.io.
The pages on Gmail and Microsoft 365 list what each connection does and what limits apply.
Questions and answers
Does mailers.io read my inbox when I connect Gmail?
No. The Gmail connection asks only to send mail and to identify the mailbox. It does not ask to read your messages.
What happens if I change my Google password?
Google can invalidate the connection when the password changes. The next send then fails, the server is disabled and the server's page offers Reconnect.
Can I still use an app password with Gmail or Microsoft 365?
For sending, you can connect the mailbox as a generic SMTP server if the provider still allows it. The dedicated Gmail and Microsoft 365 connections use OAuth.
Written by the mailers.io team. Published .