Setting up SMTP Email for a Google Workspace Account - Send Email via an App
The Problem
- You have an app.
- You want the app to send outgoing emails,
- via Google workspaces
- via SMTP
…how do you do this?
The Solution
- First, set up an app password: https://myaccount.google.com/apppasswords
Store the app name and the password.
- Set up your SMPT credentials on your app:
For example on rails, I need to do this:
# the app user name and password will be very different
# from the username password combination for your
# google workspaces account:
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => ENV['gmail_app_username'],
:password => ENV['gmail_app_password'],
:authentication => "plain",
:enable_starttls_auto => true
}
Written on January 16, 2025