How to configure SMTP with gmail?

I am currently setting up a server (self hosting). I want him to be able to send emails throught a gmail account. I haven’t seen any explanations about it anywhere in documentation or on the internet.
I’ve already set NO_EMAILS=FALSE, and SMTP_PORT=465 but informations are missing.
There is no exemple field to fill for user email and user password (like STMP_USER and STMP_PASSWORD).
What should I put in the configuration file ?

Thank you!

I finally was able to send emails from the Web App with the gmail SMTP! :tada:

First, I had to understand that set NO_EMAILS=FALSE will not disable the NO_EMAILS option! You need to comment/delete the line to enable mailing.

Next, I discovered the use of some environment variables that aren’t mentioned in file example.env:

  • SMTP_PASSWORD=YourGmailPassword

Finaly, I have this variables in the .env file:

  • SMTP_PASSWORD=YourGmailPassword
  • SMTP_PORT=587

You also need to allow SMTP on your Gmail account.

Thanks to this stackoverflow, I understood that the development mode isn’t setup to use these variables, you have to be in production mode. Actually in v9.0.2, in development mode the port is hard-coded to 1025 (why ?) and doesn’t use SMTP_USERNAME and SMTP_PORT, so it can’t send emails.


@Pitou I’m glad you were able to figure it out and thank you for sharing your your solution. I’m sure it will help many other developers.