Problem with smtplib: message vanishes

Gregor Lingl glingl at aon.at
Fri Apr 20 19:45:58 EDT 2001


Newsgroups are really a great institution!
Such a simple solution within 15 minutes!
Great!
Thanks to you and Matthew
Gregor

( And thanks for then nice German greetings....)


Sheila King schrieb:

> When you compose your message to send, make sure there is a blank line between
> the message headers and the message body.
>
> Based on what you report here, it looks to me like you're missing that blank
> line.
>
> Example:
>
> >>> import smtplib
> >>> To = "sheila at spamcop.net"
> >>> From ="nobody at spamcop.net"
> >>> Message ='''\
> ... To: sheila at spamcop.net
> ... From: nobody at spamcop.net
> ... Subject: Schoene Gruesse aus Kalifornien
> ...
> ... Hier ist das Koerper des Mails.
> ... Forgive the bad German (oops!).
> ... Ende.'''
> >>> server = smtplib.SMTP('localhost')
> >>> server.sendmail(From, To, Message)
> {}
> >>> server.quit()
> >>>
>
> Notice the blank line between the subject and the message body.
>
> HTH
> --
> Sheila King
> http://www.thinkspot.net/sheila/
> http://www.k12groups.org/
>
> On Sat, 21 Apr 2001 01:15:44 +0200, Gregor Lingl <glingl at aon.at> wrote in
> comp.lang.python in article <3AE0C320.B7D92F7C at aon.at>:
>
> :I've got the following problem:
> :
> :Using smtplib as discribed in the documentation and also in Lutz'
> :Programming Python to send emails, I'm able to send mails without
> :error messages.
> :But when trying to open it in Netscape-Messenger, I can see,
> :that I received it nut I get something like
> :
> :Betreff: python-mehl2
> : Datum:  Sat Apr 21 00:11:43 2001
> :    Von: lingl at aon.at
> :     An: glingl at aon.at
> :
> :... which means: the message-text is missing completely.
> :
> :When looking at the 'source-code' of the message, I find:
> :
> :Message-ID: <md5:109854F5E892C61A892F988123CB0A00>
> :Return-Path: <lingl at aon.at>
> :Delivered-To: glingl at aon.at
> :Received: (qmail 3793630 invoked from network); 20 Apr 2001 22:11:45
> :-0000
> :Received: from n408p010.adsl.highway.telekom.at (HELO INTERNET-WS)
> :([213.33.50.234]) (envelope-sender <lingl at aon.at>)
> :          by qmail4.highway.telekom.at (qmail-ldap-1.03) with SMTP
> :          for <glingl at aon.at>; 20 Apr 2001 22:11:45 -0000
> :From: lingl at aon.at
> :To: glingl at aon.at
> :Date: Sat Apr 21 00:11:43 2001
> :Subject: python-mehl2
> :Vielleicht geht's so!
> :probieren wirs's aus
> :Grüße
> :Gregor
> :X-Mozilla-Status: 0000
> :X-Mozilla-Status2: 00000000
> :X-UIDL: 987804705.4637304.SSP1NO49,S=520
> :
> :
> :..... which contains the message-text, which nevertheless is
> :not displayed in the email-client-window.
> :Perhaps the last three lines are the offending ones, because
> :comparing the python-sent to normal emails, i find those lines before
> :the message.
> :Or something else is going wrong.
> :
> :How could I use the sendmail-method correctly?
> :
> :... asks a little bit desparately
> :Gregor Lingl




More information about the Python-list mailing list