Deployment breaks Gmail SMTP


To handle my email, I have opted to use the ‘gmail-smtp’ plugin, which has largely been great!

The main issue I’m running into is that as soon as I run to staging, the email service no longer works from my staging site - I actually have to go into my permissions, revoke access for the site, and then re-authorize it via the plugin/oauth.

So the flow is basically this:

  • Enable and authorize gmail smtp on staging server, and confirm it works.
  • Do work on local dev
  • If any changes to plugins/backend stuff, run ./ staging
  • After that has completed, go to staging site, where email no longer works
  • Revoke authorization for the staging site from my google account permissions, and reauthorize
  • Works again

Has anyone else encountered this? Any tips?


I haven’t encountered this, but I’d guess that the plugin stores some kind of Oauth token locally, and that token gets wiped out when the deploy happens.

Unless you have a very strict requirement to use Gmail in order to send mail, I’d consider taking a look at Mailgun. It has a fairly generous free tier and a handy WP Plugin that I’ve been using for years with no problems.


I use the Post SMTP plugin with Gmail on a few sites and haven’t had any problems.

Thank you for the suggestion! I’ve implemented Postman, and it seems to be working after a few test deployments. I’ll keep an eye on it, but it seems happy for now =) Thanks again

@alwaysblank - thank you for the suggestion about Mailgun. I’ve signed up for an account, and if the other solution (going direct through gmail through another path) doesn’t work, I’ll give mailgun a shot =)

Thanks again, friends!