smtplib: subject? to?
Oleg Broytmann
phd at emerald.netskate.ru
Fri Sep 3 10:58:10 EDT 1999
Hi!
I think both code snippets have a bug - they are too indented. I think
you should spell it the following way:
mailer.sendmail('arcege at shore.net', ['gerrit.holl at pobox.com'], '''\
From: (Arcege) arcege at shore.net
To: gerrit.holl at pobox.com
Subject: Testing smtplib within Python
It seems to work.''')
Start headers from column 1.
On Fri, 3 Sep 1999, Michael P. Reilly wrote:
> With smtplib, you need to know your mail forwarder.
> import smtplib
>
> mailer = smtplib.SMTP('mailhost')
> try:
> mailer.sendmail('arcege at shore.net', ['gerrit.holl at pobox.com'], '''\
> From: (Arcege) arcege at shore.net
> To: gerrit.holl at pobox.com
> Subject: Testing smtplib within Python
>
> It seems to work.''')
> mailer.quit()
> except SMTPException, why:
> print why
>
> With sendmail, you just need the binary.
> import os
>
> mailer = os.popen('sendmail -t -i', 'w')
> mailer.write('''\
> From: (Arcege) arcege at shore.net
> To: gerrit.holl at pobox.com
> Subject: Testing smtplib within Python
>
> It seems to work.
> ''')
> rc = mailer.close()
>
> With both, you need to send the entire messages, including headers; the
> blank line seperates the headers from the message body.
>
> -Arcege
Oleg.
----
Oleg Broytmann Netskate/Inter.Net.Ru phd at emerald.netskate.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list