Python, Unix sendmail, and multiple recipients

Oleg Broytmann phd at phd.pp.ru
Tue Oct 16 12:07:45 EDT 2001


On Tue, Oct 16, 2001 at 10:58:49AM -0500, Kemp Randy-W18971 wrote:
> Can anyone give me an example of how to invoke the Unix sendmail in Python,
> and send an email message to more then one recipient (two people, for
> example)?

pipe = os.popen("/usr/sbin/sendmail me at my.host you at your.other.host", 'w')
pipe.write("""To: public at shmablic
Subject: Test

Body comes here
""")
pipe.close()

   Beware of shell metacharacters in user names! (popen uses shell)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.




More information about the Python-list mailing list