I have a python script which uses
smtplib to send out an email. I am not sure what to use for mail server name in the
On my test server I use the below and it works fine.
... server = smtplib.SMTP('localhost') server.sendmail( sender, to_addrs, msg.as_string() ) #msg is a MIMEText object server.quit()
In the actual deployment, mail is setup more explicitly and the name that works is of the form
smtp.a-domain-name. As an example, "smtp.mycompany.net". Temporarily I have added a parameter to my script and am now looking for a generic fix.
Is there a way to find out at run time what is the mail server name? Perhaps a Linux command that will return this name, or some readable system file that keeps track of it. (how does Linux
Thanks a lot.