python script send emails, how to catch and show error sending email?
<p>I have a pretty simple python script that sends emails, something like this:</p>

<pre><code>import smtplib

from email.MIMEText import MIMEText

msg = MIMEText("test email")
msg['Subject'] = // ... yada yada 

for iIndex in range(0,200):
  s = smtplib.SMTP('smptserver')
  // send the email
  s.quit()
</code></pre>

<p>My problem is, typically 1 of the 200 emails will never arrive.  I don't see any error messages on the console, so I'm assuming that the email was send to the SMTP server, and the SMTP server is dropping the ball.</p>

<p>But before I bug the SMTP guys, I want to make sure I'm not missing an error somewhere.</p>

<p>Is there somewhere other than the console where python will output the error message?</p>

<p>Thanks,
Rob</p>
