Ferrous Cranus <nikos.gr...@gmail.com> writes:

> I this hoq you mean?
[...]
>                       
>                       SUBJECT = u"Mail από τον επισκέπτη: ( %s )" % FROM
>                       
>                       MESSAGE = "\nFrom: %s\r\n" + "To: %s\r\n" + "Subject: 
> %s\r\n\r\n" % ( FROM, [TO], SUBJECT ) + MESSAGE + "\r\n"
>                       MESSAGE = MESSAGE.encode('utf-8') 
[...]
> but now iam getting this error message:
>
> sendmail => %s 13-09-04 12:29:22 (<class 'TypeError'>, TypeError('not all 
> arguments converted during string formatting',), <traceback object at 
> 0x7f0e432e1cb0>)
>
That is because you changed TO in [TO]. That causes the error.

** And the \n at the beginning shouldn't be there. **

MESSAGE = "From: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n\r\n" % ( FROM, TO, 
SUBJECT ) + MESSAGE + "\r\n"

You could even change that to:

MESSAGE = "From: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n\r\n%s\r\n" % (FROM, 
TO, SUBJECT, MESSAGE)

which I think is nicer.
-- 
Piet van Oostrum <p...@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to