smtplib question

Tim Roberts timr at probo.com
Fri Sep 19 08:33:04 CEST 2003


Garry Hodgson <garry at sage.att.com> wrote:
>
>how do i use smtplib to send mail to someone with "cc" to someone else?
>if i just include the "to" addressees in the call to smtplib.sendmail(), and
>put the others in the "Cc" header fields, only the "To" recipients get the mail,
>thought the mail headers look right.

The e-mail headers (To:, Cc:, Subject:, etc.) are not part of SMTP.  They
are ignored by sendmail and play no part at all in the e-mail delivery.
The only thing sendmail cares about is the list of addresses in the SMTP
protocol, which comes from the first parameter to smtplib.sendmail.

So, the short answer is that the address list (first parameter to
smtplib.sendmail) must include EVERYONE that should receive the message --
To, Cc, or Bcc -- in one big list.  You can put whatever you want in the
headers in the body of the message; it won't matter.  For large lists, it
is common for the header to say, for example:

    To:    recipient list suppressed

Perfectly legal.

>please respond off-list.  i had to give up following comp.lang.python for lack
>of time.

But yet, you expect us to take OUR time to answer your questions for free?
That doesn't seem right.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.




More information about the Python-list mailing list