SMTP configuration with SSL encryption

It's surprising that PLONE 5 does not allow us to configure SMTP with the SSL encryption option using the port 465.

Any solution to get around that issue?

Christian

Set TLS at http://localhost:8080/Plone/MailHost/manage_main

The underlaying zope.sendmail implementation uses TLS automatically is starttls is provided by the SMTP server...means using port 465 should be basically doing the job.

Thanks for your prompt reply.

Actually, I've already found that PLONE interface. The problem is that I'm unsure about TLS. So far, I can't send any test email from the PLONE mail configuration panel:
mail-controlpanel

When using successfully smtplib, I have:

import smtplib

smtp =
port = 465
sender =
senderPassword =

recipient =
message = 'Message'

from email.message import EmailMessage

msg = EmailMessage()
msg.set_content(message)
msg['Subject'] = 'Test'
msg['From'] = sender
msg['To'] = recipient

server = smtplib.SMTP_SSL(smtp,port)
server.set_debuglevel(3)
server.login(sender,senderPassword)
server.send_message(msg)

server.quit()

My question is: how to do the same with PLONE?

Christian

Did you try to configure port 465 in Plone???

Yep. Through the mail configuration panel.

When looking into PLONE-5 directories, I found that:

/opt/plone/buildout-cache/eggs/zope.sendmail-5.0-py3.5.egg/zope/sendmail/mailer.py

It is apparent that PLONE does not propose an SSL connection, since that file starts with

from threading import local
from ssl import SSLError
from smtplib import SMTP

There is no "from smtplib import SMTP_SSL"

1 Like

I found this workaround overriding mailer.py:

Instead of SMTP import SMTP_SSL:
from smtplib import SMTP_SSL

in class SMTPMailer instantiate SMTP_SSL like this:
smtp = SMTP_SSL

Other parameters (smtp server, port, username, password can be managed through the MailHost). You don't need to set "force TLS".

4 Likes

I open an issuer here SMTP support for TLS over port 465 is needed · Issue #3897 · plone/Products.CMFPlone · GitHub
Also i published a package which patches the mailer to use the port 465, which can be used until the issue is fixed in core.