Cannot form correctly the FORM part of the header when sending mail

Ferrous Cranus nikos at superhost.gr
Thu Sep 5 05:36:57 EDT 2013


Στις 5/9/2013 12:34 μμ, ο/η Ferrous Cranus έγραψε:
>
> Even though these examples are with ints, not strings, the precedence is
> the same.
>
> Go back to your code. Read your code. Does it look closer to this:
>
> 8 + 2 % 5
>
> or this?
>
> (8 + 2) % 5
>
>
> Can you solve this problem now?
>
> Yes Steven, according to your precedence example now i can:
>
> MESSAGE = ( "From: %s\n" + "To: %s\n" + "Subject: %s\n\n%s\n" ) % (
> FROM, TO, SUBJECT, MESSAGE )
>              MESSAGE = MESSAGE.encode('utf-8')
>
>
>
> it just need the whole concatenation thing in parenthesis so to be
> executed first but now:
>
>
>              # send the mail
>              server.sendmail( [ MESSAGE ] )
>
> or
>
>              # send the mail
>              server.sendmail( MESSAGE )
>
> both fail.
The error messge says:


nikos at superhost.gr [~]# cat /tmp/err.out
sendmail =>  13-09-05 12:20:53 (<class 'TypeError'>, 
TypeError("sendmail() missing 2 required positional arguments: 
'to_addrs' and 'msg'",), <traceback object at 0x7f3fb4f44488>)
nikos at superhost.gr [~]#

but all of the needed args are within MESSAGE.
Cant it take it from there?

-- 
Webhost <http://superhost.gr>



More information about the Python-list mailing list