smtp module

Carey Evans c.evans at clear.net.nz
Sat Jun 5 20:33:46 EDT 1999


"Michael P. Reilly" <arcege at shore.net> writes:

> Philip C. <pjc_2 at geocities.com> wrote:
> : I have pretty much figured out how to use the module but I can't seem
> : set the subject or the from of the bcc etc....

[snip]

> The protocol for SMTP requires that the headers are included.

Actually, Bcc: shouldn't be, even if some mail servers seem to work as
you expect.  If you want to Bcc: to someone, add their address to the
envelope recipients, but not the message:

>>> fromaddr = 'c.evans at clear.net.nz'
>>> toaddr = 'eggs at example.com'
>>> msg = '''From: Carey Evans <c.evans at clear.net.nz>
To: Spam, spam, spam, eggs and spam <eggs at example.com>
Subject: Something completely different

Blah, blah, blah...'''
>>> s = smtplib.SMTP('localhost')
>>> s.sendmail(fromaddr, [fromaddr, toaddr], msg)

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	     "I'm not a god.  I've just been misquoted."




More information about the Python-list mailing list