Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.python

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-10-2009, 11:29 AM
durumdara
Guest
 
Posts: n/a
Default STMP, mail, sender-from, to-bcc-addr

Hi!

I wanna ask that have anyone some experience with email.msg and smtplib?

The email message and smtp.send already have "sender/from" and
"recip/addr to".
Possible the smtp components does not uses the email tags if I not
define them only in the message?

Can I do same thing as in GMAIL that the mail does not have TO, only BCC
tags/recipients, and no one of the recipients who knows about the each
others?

Thanks:
dd

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 02-10-2009, 02:39 PM
Roel Schroeven
Guest
 
Posts: n/a
Default Re: STMP, mail, sender-from, to-bcc-addr

durumdara schreef:
> Hi!
>
> I wanna ask that have anyone some experience with email.msg and smtplib?
>
> The email message and smtp.send already have "sender/from" and
> "recip/addr to".
> Possible the smtp components does not uses the email tags if I not
> define them only in the message?


smtplib.SMTP.sendmail() does not look in the message to find the sender
or recipients; it only uses the parameters you pass.

> Can I do same thing as in GMAIL that the mail does not have TO, only BCC
> tags/recipients, and no one of the recipients who knows about the each
> others?


Include the BCC-recipients in the call to sendmail(), but don't put them
in the email message itself. Include TO-recipients in both. In other
words, what you put in the TO-header is what all recipients will see;
what you pass to sendmail() is what recipients the mail will be send to.
Simple example (not tested):

from_addr = 'foo@example.com'
to_addr = ['bar@example.com', 'xyzzy@example.com']
bcc_addr = ['spam@example.com', 'eggs@example.com']

msg = """From: %s
To: %s
Subject: test

hello
""" % (from_addr, ', '.join(to_addr))

smtp = smtplib.SMTP(...)
smtp.sendmail(from_addr, to_addr + bcc_addr, msg)


--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov

Roel Schroeven
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: sorting temporary arrays Jack Hamilton Newsgroup comp.soft-sys.sas 0 01-31-2009 05:09 AM
Re: sorting temporary arrays Ian Whitlock Newsgroup comp.soft-sys.sas 0 01-31-2009 02:49 AM
need help in Sending graph in mail body gurtej Newsgroup comp.soft-sys.sas 1 03-27-2007 07:10 PM
Re: email to mail lists F. J. Kelley Newsgroup comp.soft-sys.sas 0 12-23-2004 08:42 PM



All times are GMT. The time now is 05:44 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.