smtplib.py how to ?

Oleg Broytmann phd at phd.russ.ru
Sat Nov 6 06:34:44 EST 1999


On Sat, 6 Nov 1999, Colm Rafferty wrote:
> import smtplib
> s=smtplib.SMTP("localhost")
> tolist=["cgr at formulae.co.uk","c.rafferty at virgin.net","cgr at pangea.co.uk"]
> msg = '''
> From: test at my.org
> Subject: testin'...
> 
> This is a first test '''
> 
> s.sendmail("me at mydomain.co.uk",tolist,msg)
> s.quit()

   You've inserted empty line, so sendmail recognized it as "end of
headers". Do this way:

      vvvvv - no empty line here
msg = '''From: test at my.org
Subject: testin'...

This is a first test '''

or this:

      vvvv
msg = '''\
From: test at my.org
Subject: testin'...

This is a first test '''

Oleg.
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list