Introduction
In this guide we will use Gmail SMTP to send emails on our Odoo app, we'll do so be generating an App Password and setting an Outgoing Mail Server on Odoo.
Prerequisites
Generate an App Password
We will use the App Password to authenticate through Odoo to send emails using the provided Gmail account. To use App Passwords make sure your account has 2-step verification, else you will not see the App Password setting. The steps to generate an App Password:
- Go to your Google account settings by clicking on your accounts icon > Manage your Google Account.
- In the search bar search for App Passwords and click on the result.
- Provide an App name, personally I write the domain name here and click Create. Save the App Password as you will not be able to view it again.
Create the Outgoing Mail Server on Odoo
After generating the App Password we are ready to setup our Outgoing Mail Server on Odoo. Follow the below steps:
- Activate developer mode by going to Settings > General Settings > Developer Tools > Activate the developer mode.
- On the same General Settings page go to Technical (top menu) > Email > Outgoing Mail Servers.
- Click on New, give it a descriptive name, personally I name it as my email, set Authenticate with as Username, for Connection Encryption set it as TLS (STARTTLS), set the SMTP Server as smtp.gmail.com, set the SMTP Port as 587, set the Username as your Gmail email and set the Password as the App Password generated previously.
- Click on Text Connection button above to test the connection.
By following the above steps you should have a functioning outgoing email that you could use within your Odoo modules.
If you'd like to force a single "from" email for all modules then you could do so with simple configuration found here.