Ernesto wrote:
[color=blue]
>Is there a special module for mail ?
>
>I'd like to send an email [to 'n' unique email addresses] from a python
>script.
>
>[/color]
Ernesto wrote:[color=blue]
> Is there a special module for mail ?
>
> I'd like to send an email [to 'n' unique email addresses] from a python
> script.
>
> Thanks !
>[/color]
This class makes what you want to do extremely easy.
Ernesto wrote:[color=blue]
> Is there a special module for mail ?
>
> I'd like to send an email [to 'n' unique email addresses] from a python
> script.[/color]
from email.MIMEText import MIMEText
import email.Utils
import smtplib
# 'users' is a list of email addys.
for u in users:
try:
print "Sending email to ... ", u
f = "FROM_NAME<FROM _EMAIL_ADDY@YOU R_DOMAIN.com>"
t = u
msg = MIMEText("""MES SAGE BODY OF EMAIL""")
msg["Subject"] = "MESSAGE SUBJECT"
msg["Message-id"] = email.Utils.mak e_msgid()
msg["From"] = f
msg["To"] = t
h = "YOUR.SMTP.SERV ER"
s = smtplib.SMTP(h)
s.sendmail(f, t, msg.as_string() )
s.quit()
except Exception, e:
print e
Ernesto wrote:[color=blue]
> I guess that was jerk-off version of:
>
> "smtplib"
>
> Thanks a lot.
>[/color]
Well, it gave you the information you wanted, right? (Except that it
might have mentioned the "email" package, which would help you
formulating the messages as well.
But that which doesn't kill us makes us stronger, and at least you
aren't dead :-)
Hang around here long and you'll see a bunch of people waiting on
replies to questions Google could have given them far quicker. If we
weren't paid thousands of dollars a week to answer questions on this
list we'd probably get snarky more often.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogs pot.com
Ernesto a écrit :[color=blue]
> Is there a special module for mail ?
>
> I'd like to send an email [to 'n' unique email addresses] from a python
> script.[/color]
If you want all adressee to be the only one visible in to: field, you
must send n emails.
On 2006-03-08, Steve Holden <steve@holdenwe b.com> wrote:
[color=blue]
> Hang around here long and you'll see a bunch of people waiting
> on replies to questions Google could have given them far
> quicker. If we weren't paid thousands of dollars a week to
> answer questions on this list we'd probably get snarky more
> often.[/color]
That reminds me: I haven't seen last weeks check yet. I trust
it will arrive soon...
--
Grant Edwards grante Yow! I feel like I am
at sharing a "CORN-DOG" with
visi.com NIKITA KHRUSCHEV...
On Wed, 08 Mar 2006 06:20:42 +0000, rumours say that Steve Holden
<steve@holdenwe b.com> might have written:
[color=blue]
> If we
>weren't paid thousands of dollars a week to answer questions on this
>list we'd probably get snarky more often.[/color]
Steve, please, don't make me look like a liar in front of the children!
--
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
Dennis Lee Bieber wrote:[color=blue]
> On Wed, 08 Mar 2006 06:20:42 +0000, Steve Holden <steve@holdenwe b.com>
> declaimed the following in comp.lang.pytho n:
>[color=green]
>>Hang around here long and you'll see a bunch of people waiting on
>>replies to questions Google could have given them far quicker. If we
>>weren't paid thousands of dollars a week to answer questions on this
>>list we'd probably get snarky more often.[/color]
>
> What! Why didn't anyone tell me where to submit my timecard?[/color]
It's by the *byte*, Dennis. How did you think Alex managed all that
time off real work to write a book on Python (like anyone buys those)?
Comment