Currently we have a server (Windows 2003 sp2) that runs python scripts overnight, and then emails us whether the scripts ran correctly, I am transferring these scripts to a new server (also Windows 2003 SP2), however when the script tries to use the smtplib module, i get the following error in the pythonwin IDE.
File "D:\Python26\ArcGIS10.0\lib\smtplib.py", line 239, in __init__
(code, msg) = self.connect(host, port)
File "D:\Python26\ArcGIS10.0\lib\smtplib.py", line 296, in connect
(code, msg) = self.getreply()
File "D:\Python26\ArcGIS10.0\lib\smtplib.py", line 340, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed
Is there anything I need to do on the server to get the script to send emails?
Thanks
If the python code worked on the previous server it's unlikely to be a problem with the python code itself. I would suggest troubleshooting basic email sending functionality with a telnet session to verify everything is working properly. Examples of testing SMTP functionality with telnet are available at these URLs:
The issue may be firewall related on the server the python code is running on or the email server itself. The issue may also be the configuration of the mail server itself is configured to only accept outgoing email from certain systems.