[Tutor] smtoplib script appears bogus

Kirk Bailey deliberatus@my995internet.com
Tue, 11 Dec 2001 23:55:12 -0500


This thing don't work. Beats me why, I copied it from the on line docs
for the language, but there ya go.
-----------------select aged bits---------------
     import smtplib
     import string

     def prompt(prompt):
         return raw_input(prompt).strip()

     fromaddr = prompt("From: ")
     toaddrs  = prompt("To: ").split()
     print "Enter message, end with ^D:"

     # Add the From: and To: headers at the start!
     msg = ("From: %s\r\nTo: %s\r\n\r\n"
            % (fromaddr, string.join(toaddrs, ", ")))	# probably word
wrapped.
     while 1:						# when all on one line, it still don't work right.
         try:
             line = raw_input()
         except EOFError:
             break
         if not line:
             break
         msg = msg + line

     print "Message length is " + `len(msg)`

     server = smtplib.SMTP('localhost')
     server.set_debuglevel(1)
     server.sendmail(fromaddr, toaddrs, msg)
     server.quit()
------------------------------------------------------
-- 
Respectfully,
             -Kirk D Bailey (C)2001
              Addme! icq #27840081
end


Within the sweep of his sword, Each man is an Ubar.

http://www.howlermonkey.net/
http://www.sacredelectron.org/