OK, this worked, please disregard my last. The online docs at
<a href="http://python.org">python.org</a> told me the answer to that one. Between their example and
yours, i am able to make it work.<br>
thanks a whole bunch !<br>
<br>
shawn<br><br><div><span class="gmail_quote">On 7/31/06, <b class="gmail_sendername">Justin Ezequiel</b> <<a href="mailto:justin.mailinglists@gmail.com">justin.mailinglists@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
When I first started with Python, I used MimeWriter to create E-mails.<br><br>Then some mail servers rejected my E-mails.<br><br>Some research (google) indicated (to me) that I needed a MIME-Version header.<br>(Can't recall now if I also needed a Content-Type header.)
<br><br>Anyway, more research (Python docs) indicated that I should use the<br>email package instead.<br>I have been doing so since and have not had reports of anymore rejected E-mails.<br><br>Hope this helps.<br><br>>>> import email
<br>>>> from email.MIMENonMultipart import MIMENonMultipart<br>>>> from email.Utils import formataddr<br>>>> format_addresses = lambda pairs: ', '.join([formataddr(pair) for<br>pair in pairs])<br>
>>> msg = MIMENonMultipart('text', 'plain', charset='us-ascii')<br>>>> msg.set_payload('Foo Bar')<br>>>> msg.add_header('From', formataddr(('Justin', '<a href="mailto:a@b.com">a@b.com</a>')))<br>
>>> msg.add_header('To', format_addresses([('Justin', '<a href="mailto:a@b.com">a@b.com</a>'),<br>('You', '<a href="mailto:c@e.com">c@e.com</a>')]))<br>>>> print msg.as_string()<br>Content-Type: text/plain; charset="us-ascii"
<br>MIME-Version: 1.0<br>From: Justin <<a href="mailto:a@b.com">a@b.com</a>><br>To: Justin <<a href="mailto:a@b.com">a@b.com</a>>, You <<a href="mailto:c@e.com">c@e.com</a>><br><br>Foo Bar<br>>>>
<br>_______________________________________________<br>Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor
</a><br></blockquote></div><br>