smtplib

Johannes Stezenbach yawyi at gmx.de
Mon Jun 26 06:47:40 EDT 2000


Peter Timaratz <timaratz at lisco.com> wrote:
>I'm using smtplib with a CGI script. I'm puzzled as to why this module
>doesn't support sending a subject for the e-mail.
>
>And the e-mail I receive doesn't show the to address in my e-mail client.

smtplib implements SMTP as per RFC 821, which defines the transport
protocol only, not the format of the message content. See RFC 822
for that.

Subject and From headers are part of the message body.
To and From adresses in SMTP are sometimes called "envelope"
adresses, and can be different from the adresses on the message
inside the envelope. SMTP servers usually put Received headers in
front of the messages they receive to capture the envelope
adresses, but they are not normally displayed in email clients.
Most email clients have an option to display all headers or the
raw message ("view" -> "page source" in Netscape).

In short: Place any headers like From:, Subject: and Date: in
front of your message. Header and Body are separated by a single
blank line.

Johannes




More information about the Python-list mailing list