Configuring Plone email SMTP when ssl is required

I can't connect my site to my email server. I've done so in the past with "local host".

I've read this: SMTP configuration with SSL encryption - #7 by grimpelub

Per my host, I use:

Outgoing (SMTP):
            smtpout.secureserver.net
            465 (SSL) 587 (TSL/SSL - Mac)   80, 3535 or 25

user/pwd

I have my email server on the same server as my Plone site.

How do people do this on their sites?

@rileydog You didn't specify, but based on other questions I assume this is asking about the deployment scenario where the Plone backend is running in a Docker container.

In Docker, "localhost" can only connect to ports from processes running in the same container. To connect to ports on the same host machine but not in the same container, see nginx - From inside of a Docker container, how do I connect to the localhost of the machine? - Stack Overflow

@davisagli thanks. i looked at the link. I'm not sure this is what i want (or know how to do :slight_smile: )

Here is my setup:

  1. i have a VPS at tsohost.com
  2. domains are managed by tsohost
  3. Plone hosted here.
  4. I host my email here, also; however, the email is another server (host.secureserver.net)
    ======================================
    I have to assume this is a very typical setup and Plone should be able to handle it.

I want to check the Plone SMTP logs but don't know where they are with the standard Plone/Docker installation.

Thanks

Okay, since the email server is separate, forget what I said. In your original message you said "I have my email server on the same server as my Plone site" but it sounds like you meant a separate server from the same provider.

The Plone docker images do not include an SMTP server. You are expected to configure Plone to use an external SMTP server, not localhost. In this case it sounds like you need to use smtpout.secureserver.net or host.secureserver.net (I'm not sure which, you mentioned both above).

In Docker, logs for the container's main process typically go to stdout rather than to a file. The Docker host captures them and you can view them with docker logs [container id]. For the Plone backend image, these are the logs you are used to finding in the instance log. There is no separate SMTP log, because there is no SMTP software included.

David,
thanks for clarify the no-SMTP in docker image.

You nailed it in your answer - I should have been clearer when i referred to the email server being on the same - it obviously isn't.

However, It still doesn't work, even when i setup as per the host instructions -
Outgoing Server: 125.50.167.72.host.secureserver.net SMTP Port: 465

Note: independent of Plone, the email works - i've tested sending and receiving.


i found the log you reference. I'll attach a small bit here to see if this helps. (note; i tried both local and the above setup during testing and it produced the same log entries (as far as I can tell)

2023-04-13 02:55:06 ERROR [Plone:89][waitress-1] Unable to send test e-mail.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/smtplib.py", line 398, in getreply
line = self.file.readline(_MAXLINE + 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 706, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/lib/python3.11/site-packages/Products/CMFPlone/controlpanel/browser/mail.py", line 80, in handle_test_action
mailhost.send(message,
File "/app/lib/python3.11/site-packages/Products/MailHost/MailHost.py", line 215, in send
self._send(mfrom, mto, msg, immediate)
File "/app/lib/python3.11/site-packages/Products/MailHost/MailHost.py", line 322, in _send
self._makeMailer().send(mfrom, mto, messageText)
File "/app/lib/python3.11/site-packages/zope/sendmail/mailer.py", line 89, in send
self.vote(fromaddr, toaddrs, message)
File "/app/lib/python3.11/site-packages/zope/sendmail/mailer.py", line 62, in vote
self.connection = self.smtp(self.hostname, str(self.port))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/smtplib.py", line 255, in init
(code, msg) = self.connect(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/smtplib.py", line 343, in connect
(code, msg) = self.getreply()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/smtplib.py", line 401, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed: "

@rileydog if I remember correctly SMTP over SSL (port 465) has been deprecated for years, if it is possible try SMTP+TLS (port 587), and there is no need to change zope.sendmail.

@mamico this is not true anymore, the prefered way today is TLS over 465 and the STARTTLS is deprecated now.
https://www.rfc-editor.org/rfc/rfc8314
So we should support 465 in Plone asap.
I open an issue for this SMTP support for TLS over port 465 is needed · Issue #3897 · plone/Products.CMFPlone · GitHub.

2 Likes