SMTP settings for implicit TLS (port 465)

Nagy Gabor <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <20230131170227.22ff0507@Dell>
Dear Roundup developers,

I want to configure Roundup to use an SMTP server through the
SMTPS protocol (SMTP over TLS/SSL, port 465, no starttls support).

After reading the smtplib documentation
(https://docs.python.org/3/library/smtplib.html), the following patch
seems to work with python3 (after setting tls='no' in config.ini):

--- a/roundup/mailer.py
+++ b/roundup/mailer.py
@@ -295,11 +295,11 @@ class Mailer:
                 raise MessageSendError("Error: couldn't send email: %s" % msg)
 
 
-class SMTPConnection(smtplib.SMTP):
+class SMTPConnection(smtplib.SMTP_SSL):
     ''' Open an SMTP connection to the mailhost specified in the config
     '''
     def __init__(self, config):
-        smtplib.SMTP.__init__(self, config.MAILHOST, port=config['MAIL_PORT'],
+        smtplib.SMTP_SSL.__init__(self, config.MAILHOST, port=config['MAIL_PORT'],
                               local_hostname=config['MAIL_LOCAL_HOSTNAME'])
 
         # start the TLS if requested

I already mentioned that this seems to work, but as I am not an expert of
either the Roundup code or smtplib, I would like to ask your opinion, too.
I hope there are no hidden mines in Roundup's source code that I missed. :)

Regards,
Gábor Nagy


_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.