P
Philippe C. Martin
Hi,
I am testing the smtp module and have the following question:
in the code below (taken from net sample) prior to adding the "Subject:"
field, the email client found the "From" and the "To". Without the
"Subject:" field on I get this:
Email client = Evolution: the "From" field is blank
Email client = KMail: the "To" field is blank
Any clue ?
Thanks and regards,
Philippe
**********************
import smtplib
def prompt(prompt):
return raw_input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
print "Enter message, end with ^D (Unix) or ^Z (Windows):"
# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs)))
while 1:
try:
line = raw_input()
except EOFError:
break
if not line:
break
msg = msg + line
print "Message length is " + repr(len(msg))
server = smtplib.SMTP('smtp.sbcglobal.yahoo.com')
server.set_debuglevel(1)
server.login ('xxxxx','yyyyyyy')
server.sendmail(fromaddr, toaddrs, 'Subject:from python\n\n'+msg)
server.quit()
--
***************************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***************************
I am testing the smtp module and have the following question:
in the code below (taken from net sample) prior to adding the "Subject:"
field, the email client found the "From" and the "To". Without the
"Subject:" field on I get this:
Email client = Evolution: the "From" field is blank
Email client = KMail: the "To" field is blank
Any clue ?
Thanks and regards,
Philippe
**********************
import smtplib
def prompt(prompt):
return raw_input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
print "Enter message, end with ^D (Unix) or ^Z (Windows):"
# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs)))
while 1:
try:
line = raw_input()
except EOFError:
break
if not line:
break
msg = msg + line
print "Message length is " + repr(len(msg))
server = smtplib.SMTP('smtp.sbcglobal.yahoo.com')
server.set_debuglevel(1)
server.login ('xxxxx','yyyyyyy')
server.sendmail(fromaddr, toaddrs, 'Subject:from python\n\n'+msg)
server.quit()
--
***************************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***************************