[Tutor] SMTP Mail

James.Rocks@equant.com James.Rocks@equant.com
Wed, 16 Oct 2002 15:27:55 +0100


More dumb questions I'm afraid ... I do look up in the docs first ...
honest! :-)

OK ... I'm trying to make SMTP Mail work (module smtplib) and, well, it
does ... sort of.

This is the program I'm using to test it:

      import smtplib

      sToAddress = "james.rocks@equant.com"
      sFromAddress = "james.rocks@equant.com"
      sMessage = "Test Message"

      sSMTPServer = smtplib.SMTP(<SMTPSERVER>)
      sSMTPServer.set_debuglevel(1)
      sSMTPServer.sendmail(sFromAddress, sToAddress, sMessage)
      sSMTPServer.quit()

It's essentially copied direct from the docs without all the fancy bits ...
I was planning to put it in a function so I could call it with a from & to
address and a message. As it's a warning that's really all that's needed
though a body paramater might be nice later.

Anyway it worked, it mailed me which is good but instead of getting what I
expected (a message from me, to me entitled "Test Message") I got a message
with no title and "Message" in the body and I don't know enough about SMTP
mail to figure why?

James

James C. Rocks
Equant
Archway House
Canary Wharf
London E14 9SZ