Hi Mark,

        Thanks.  With that information I was able to get the code working.  Now 
I just have to find the right machine to run it on instead of my personal box.

Joe

On Jul 7, 2010, at 8:33 PM, Mark Sapiro wrote:

> On 7/7/2010 1:53 PM, Joe Hughes wrote:
>> All,
>> 
>> As you can see below I'm a bit baffled.  I got the code working by
>> commenting three lines, but I would like to have to, from, and date in
>> the header.  Any suggestions on how to make this work?
>> 
> [...]
>> except:
>>    mail_from = USERNAME
>>    mail_to = ['us...@company.com',
>>               'us...@company.com']
> 
> 
> This is cause the problem.
> 
> [...]
>>    try:
>>        message = "No response from " + MAIL_SERVER + " Possibly down."
>>        msg = MIMEMultipart()
>> #        msg['from'] = mail_from
>> #        msg['to'] = mail_to
>> #        msg['date'] = email.utils.formatdate(localtime=True)
> 
> 
> You are setting msg['To'] to a list. It needs to be a string, e.g.
> 
>        if isinstance(mail_to, list):
>            msg['To'] = ', '.join(mail_to)
>        else:
>            msg['To'] = mail_to
> 
> 
> Also, when you set headers, they will be capitalized or not as you set
> them so set msg['From'], msg['To'], msg['Date'] and msg['Subject'].
> 
> -- 
> Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
> San Francisco Bay Area, California    better use your sense - B. Dylan
> 

_______________________________________________
Email-SIG mailing list
Email-SIG@python.org
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to