Fw: sendmail error

Alexander Kapps alex.kapps at web.de
Tue Aug 31 09:41:23 EDT 2010


sandric ionut wrote:
>>   Three things:  When quoting code, do it exactly, and without wordwrap 
>> in your mail program.  There are so many typos in that code sample that 
>> it's     useless, presumably because you didn't use copy/paste
>  
> The code was COPY and PASTE -> presume wrong
> 
>>    When quoting an error message, get it all.  Since you omit the 
>> stacktrace part, we can't tell what line might be giving you that error
>  
> That is all the error code!!!
> 
>>     Once you've noticed which line, just examine the types of each of 
>> the elements you're combining.  If you're using the + operator, and the 
>> left operand is a string, then the right one must also be string.  
>> Figure out why it's not and you have your own answer
>  
> Do you really think that I didn't do it? What a... response. This + or , 
> is really USELESS. Please don't bother to send useless replays
> This is the line where I get the error: smtpObj.sendmail(fromEmail, 
> toEmail, mesaj.as_string())


Indeed, what a response. But from you. Do you always attack people 
who tried to help you?

Dave Angel, gave you a very useful hint on how to debug such errors. 
  In particular, he asked you to paste the *full* traceback.

And if your mail/news client messes up the code so heavily, it's 
probably time to move to a better client.

And the mention of + is not useless. If you would have tried a 
little harder, you would probably find, that concatenating a string 
and an exception object, gives exactly the error you got.



So, the problem is probably here:

print "eroare: " + smtplib.SMTPException

Instead you want something like:

except smtplib.SMTPException, msg
     print "eroare: " + msg


If you are sure, that's not the line which gave the error, again, 
post the *full* traceback.

Next time, show a little more civility and follow the advices you 
got. "Help us, to help you." is the word.

HTH



More information about the Python-list mailing list