blog

Using the Gmail SMTP server to send emails from Plone

| categories: plone, email, gmail

Need to test emails on a local test instance, or just too lazy to set up your own mail server? Just use Google's smtp server!

It is possible to use Gmail's smtp server to send emails from your Plone site. It's very simple and I'll show you how.

You'll of course need a Gmail account, get one here.

Setup

In your Plone site, log in as the administrator, then go to 'Site Setup' and then 'Mail'.

Now in the form, give the following values:

  • SMTP server: smtp.gmail.com
  • SMTP port: 587
  • ESMTP username: Here you give your gmail email address, i.e john@gmail.com
  • ESMTP password: Give your gmail account password.
  • Site 'From' name: Use the default or whatever you prefer.
  • Site 'From' address: This is the reply-to address on the email. For users it would seem as if the email was sent from this address. It's important that this address belongs to a user in the site, since it's also the address to which emails will be sent when users contact the administrator via the 'contact' form.

Troubleshooting:

  • Make sure TLS is enabled. This dіdn't work for me until I went to the ZMI (Site Setup > Zope Management interface), clicked on MailHost and uncheck the 'Disable TLS' checkbox (the last option).
  • Also, make sure that your Python instance is compiled with SSL support.
  • Make sure that IMAP support is enabled for your Gmail account. When in Gmail, click on the 'settings' link at the top right, then the 'Forwarding and POP/IMAP' link and enable IMAP access.

Now, in your Plone site, click on the 'contact' link in your site and send yourself a congratulatory email!