Python, Unix sendmail, and multiple recipients

Skip Montanaro skip at
Tue Oct 16 18:08:17 CEST 2001

    Randy> Can anyone give me an example of how to invoke the Unix sendmail
    Randy> in Python, and send an email message to more then one recipient
    Randy> (two people, for example)?

How about:

    fwd = os.popen('/usr/sbin/sendmail -odb -t', 'w')
    fwd.write('To: skip at\n')
    fwd.write('To: Randy.L.Kemp at\n')
    fwd.write('Subject: Hey there!\n')

where "body" is a list of newline-terminated strings.

Any particular reason why you don't want to use smtplib?

Skip Montanaro (skip at

More information about the Python-list mailing list