You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experiencing an issue with the Google SMTP relay mailer. The Google SMTP service receives 127.0.0.1 and is refusing to connect, because the local_hostname is not set.
When I manually supply the local_hostname to the base Python SMTP service init method, it works as expected
connection = self.smtp(hostname, port, timeout=timeout, local_hostname=<actual server name>)
May I request that you accept local_hostname in the SMTPMailer class and forward this parameter to the base Python SMTP class please?
class SMTPMailer(object):
smtp = SMTP # allow replacement for testing.
smtp_ssl = SMTP_SSL # allow replacement for testing.
def __init__(self, hostname='localhost', port=25,
username=None, password=None,
no_tls=False, force_tls=False, ssl=False, debug_smtp=False): <---- Accept local_hostname here
self.hostname = hostname
self.port = port
self.username = username
self.password = password
self.force_tls = force_tls
self.no_tls = no_tls
self.ssl = ssl
self.debug_smtp = debug_smtp
def smtp_factory(self):
hostname = self.hostname
port = str(self.port)
timeout = 10
if self.ssl:
if self.smtp_ssl is None:
raise RuntimeError('No SSL available, cannot send via SSL')
connection = self.smtp_ssl(hostname, port, timeout=timeout) <------- Pass local_hostname here
else:
connection = self.smtp(hostname, port, timeout=timeout) <------- Pass local_hostname here
connection.set_debuglevel(self.debug_smtp)
return connection
The text was updated successfully, but these errors were encountered:
roryodonnell
changed the title
SMTPMailer not passing 'local_hostname' to base bass SMTP class
SMTPMailer not passing 'local_hostname' to base Python SMTP class
Jul 26, 2023
I am experiencing an issue with the Google SMTP relay mailer. The Google SMTP service receives 127.0.0.1 and is refusing to connect, because the
local_hostname
is not set.When I manually supply the
local_hostname
to the base Python SMTP service init method, it works as expectedMay I request that you accept
local_hostname
in the SMTPMailer class and forward this parameter to the base Python SMTP class please?The text was updated successfully, but these errors were encountered: