[Tutor] Error Using A List And SMTP

Sarma Tangirala tvssarma.omega9 at gmail.com
Wed May 16 13:34:20 CEST 2012


Hi Walter,


> All the headers in the MimeText object needs to be strings.  You can't
> directly pass a list object containing multiple recipients to the "To"
> header of your MimeText object on line 31 in your code, and expect it to
> work.  You've got to instead first convert the list to valid string and
> assign that instead, as that's what the MimeText object expects.  You can
> infer this from your error messages since lstrip() is a string method, and
> the code is (rightly) complaining that a list doesn't have an lstrip()
> method, which is understandable becuase you're getting the error when you
> pass a list as parameter.
>
>
Thank you for clearing that. Stupid mistake here. I forgot to change the
variable names.

But I do have another question. Maybe this is a misunderstanding about the
MimeText type, but why does MimeText care about the To field when the
actually sending is being done by SMTP?



-- 
Sarma Tangirala,
Class of 2012,
Department of Information Science and Technology,
College of Engineering Guindy - Anna University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120516/cf0050ec/attachment.html>


More information about the Tutor mailing list