msg["To"] is essentially what is printed on the letter. It doesn't actually
have any effect.

# single recipients,
s.sendmail(me, '[email protected]', msg.as_string())

# for Muliple recipients,

recipients = ['[email protected]','[email protected]','
[email protected]']
....
s.sendmail(me, recipients, msg.as_string())

for much more detail,
http://stackoverflow.com/questions/8856117/how-to-send-email-to-multiple-recipints-using-python-smtplib

http://docs.python.org/2/library/smtplib.html#smtplib.SMTP.sendmail


On Fri, Jan 31, 2014 at 11:29 AM, hari prasadh <[email protected]>wrote:

> apologies.sending with the correct content.
> Hi All,
>
> In sendmail function not able to send mail to mutiple recipients.
> import smtplib
> from email.mime.text import MIMEText
> def sendEmail():
>         message="hello world"
>         msg = MIMEText(message)
>         msg['Subject'] = 'Message:'+message
>         msg['From'] = '[email protected]'
>         recipients = ['[email protected]','[email protected]']
>         msg['To'] = ", ".join(recipients)
>
>
> #       msg['To'] = '***@***.com'
>         s = smtplib.SMTP('*.*.*.*','25')
>         s.sendmail(msg['From'], msg['To'], msg.as_string())
>
> if __name__ == "__main__":
>         sendEmail()
>
> the mail doesnt reached the second recipients in the list.
> Please help
>
>
> On Fri, Jan 31, 2014 at 11:27 AM, hari prasadh <[email protected]
> >wrote:
>
> > def sendEmail():
> >         message="hello world"
> >         msg = MIMEText(message)
> >         msg['Subject'] = 'Message:'+message
> >         msg['From'] = '[email protected]'
> >         recipients = ['[email protected]','[email protected]']
> >         msg['To'] = ", ".join(recipients)
> >
> >
> > #       msg['To'] = '***@***.com'
> >         s = smtplib.SMTP('*.*.*.*','25')
> >         s.sendmail(msg['From'], msg['To'], msg.as_string())
> >
> > if __name__ == "__main__":
> >         sendEmail()
> >
> >
> > --
> > Thanks & Regards,
> > HariPrasadh
> >
>
>
>
> --
> Thanks & Regards,
> HariPrasadh
> _______________________________________________
> ILUGC Mailing List:
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
> ILUGC Mailing List Guidelines:
> http://ilugc.in/mailinglist-guidelines
>
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines

Reply via email to