[Zope] Mail sending Problem in Python

Paula Mangas pamm@students.si.fct.unl.pt
Mon, 7 Jan 2002 09:33:27 +0000 (WET)


Hi!


Try something like this,


-----------
recipients = string.splitfields(to_addr, ',')

msg_to_send = """From : %s\nTo: %s\nSubject: %s\n\n%s""" % ( from_addr, to_addr , subject , msg )
s = smtplib.SMTP(host, port)
s.sendmail(from_addr, recipients, msg_to_send)
s.close()
-----------

where msg, subject, to_addr and from_addr are strings
if you want more that one recipient, you separate them by character ','
on string to_addr.

msg: is you message body;
subject, from_addr, to_addr, host and port have the mean expected.

I hope this can help,
Paula Mangas


PS: you must import string and smtplib modules.






On 7 Jan 2002, Jebakumar wrote:

>
>
> hai ,
> i am facing problem in mail sending method or function in python,
> anybody knows about this, please send me a mail with example program,
> ***mainly i am facing problem in 'encode'type.
> Thank u.
> regards,
> Jebakumar.Richard
>
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>