Python, email temperature
Terry Reedy
tjreedy at udel.edu
Sun Dec 23 19:31:32 EST 2012
On 12/23/2012 12:23 PM, Mitya Sirenef wrote:
> On 12/23/2012 08:46 AM, KarlE wrote:
>> On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote:
>> from __future__ import division
Depending on the linux installed, you should be able to run 3.2 or 3.3
instead of 2.7. Though there are still 2.x only modules, some things
work better in 3.x (including default division).
>> server.sendmail(fromaddr, toaddrs, ord)
>> server.quit()
>>
>> main()
>>
> I'm not sure if Raspberry Pi has it, but usually you want to
> use the email module, as in example on this page:
>
> http://docs.python.org/2/library/email-examples.html#email-examples
3.2+ have a separate .send_message method for email message objects.
> I think what happens is that because your message starts
> with 'Subject:', it's interpreted as subject header instead of
> an email. You can try adding two newlines after Subject:,
> that might help... but using email module is best if possible.
The 3.3 SMTP doc says that the fromaddr and toaddrs are only used by the
transport layer and do not become part of the email message. The doc
example has
msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs)))
The body is appended after the double return. A subject line and any
other standard headers would go before.
OT note: the PSF (Python Software Foundation) has bought a Raspberry PI
and another ARM board to test Python on. I am happy to read that it
seems to be working so far.
--
Terry Jan Reedy
More information about the Python-list
mailing list