11 个解决方案
#1
关注ing……
#2
email -- An email and MIME handling package
http://www.python.org/doc/current/lib/module-email.html
上面这个不错,好像可以解决楼主的问题
http://www.python.org/doc/current/lib/module-email.html
上面这个不错,好像可以解决楼主的问题
#3
python manual里面介绍的smtplib, poplib 都可以用来发收邮件, 都有实例介绍,改改就成自己的了
如果要发比较复杂内容格式的邮件,看email, email.Message,可以封装比较复杂内容的邮件。
如果要发比较复杂内容格式的邮件,看email, email.Message,可以封装比较复杂内容的邮件。
#4
多谢各位,小弟试着运行了一下smtplib.py但到server.sendmail(fromaddr,
toaddrs, msg)一句时出现: raise
SMTPRecipientsRefused(senderrs)
SMTPRecipientsRefused: {'caoyan...@gmail.com': (550, '5.7.1 Unable to
relay for
caoyan...@gmail.com')}异常,不知是怎么回事,应如何解决呀
toaddrs, msg)一句时出现: raise
SMTPRecipientsRefused(senderrs)
SMTPRecipientsRefused: {'caoyan...@gmail.com': (550, '5.7.1 Unable to
relay for
caoyan...@gmail.com')}异常,不知是怎么回事,应如何解决呀
#5
gmail 的smtp比较复杂, 需要tls支持,还要 用户名密码
换个其他的邮箱看看,比如126, 163的.
换个其他的邮箱看看,比如126, 163的.
#6
我用的就是163的smtp呀,哪位高人有能成功运行的例子呀,小弟谢了谢了
#7
有哪位大侠救我呀,小弟谢过了,否则今天小弟就别想回家!!!!!!!!!!!!!!!!!!
#8
smtplib, poplib
好像有一个:esmtplib
举例:
try:
smtp = esmtplib.ESMTP(smtpServer, username, password)
failedRecv = smtp.sendmail(mailAcct, map(string.strip, string.split(email_to, ",")), msg)
smtp.quit()
except smtplib.SMTPServerDisconnected :
pass
except smtplib.SMTPSenderRefused :
好像有一个:esmtplib
举例:
try:
smtp = esmtplib.ESMTP(smtpServer, username, password)
failedRecv = smtp.sendmail(mailAcct, map(string.strip, string.split(email_to, ",")), msg)
smtp.quit()
except smtplib.SMTPServerDisconnected :
pass
except smtplib.SMTPSenderRefused :
#9
我的Lib目录里没有esmtplib.py呀,再说,有没有注释呀
#10
gz
#11
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('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
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('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
#1
关注ing……
#2
email -- An email and MIME handling package
http://www.python.org/doc/current/lib/module-email.html
上面这个不错,好像可以解决楼主的问题
http://www.python.org/doc/current/lib/module-email.html
上面这个不错,好像可以解决楼主的问题
#3
python manual里面介绍的smtplib, poplib 都可以用来发收邮件, 都有实例介绍,改改就成自己的了
如果要发比较复杂内容格式的邮件,看email, email.Message,可以封装比较复杂内容的邮件。
如果要发比较复杂内容格式的邮件,看email, email.Message,可以封装比较复杂内容的邮件。
#4
多谢各位,小弟试着运行了一下smtplib.py但到server.sendmail(fromaddr,
toaddrs, msg)一句时出现: raise
SMTPRecipientsRefused(senderrs)
SMTPRecipientsRefused: {'caoyan...@gmail.com': (550, '5.7.1 Unable to
relay for
caoyan...@gmail.com')}异常,不知是怎么回事,应如何解决呀
toaddrs, msg)一句时出现: raise
SMTPRecipientsRefused(senderrs)
SMTPRecipientsRefused: {'caoyan...@gmail.com': (550, '5.7.1 Unable to
relay for
caoyan...@gmail.com')}异常,不知是怎么回事,应如何解决呀
#5
gmail 的smtp比较复杂, 需要tls支持,还要 用户名密码
换个其他的邮箱看看,比如126, 163的.
换个其他的邮箱看看,比如126, 163的.
#6
我用的就是163的smtp呀,哪位高人有能成功运行的例子呀,小弟谢了谢了
#7
有哪位大侠救我呀,小弟谢过了,否则今天小弟就别想回家!!!!!!!!!!!!!!!!!!
#8
smtplib, poplib
好像有一个:esmtplib
举例:
try:
smtp = esmtplib.ESMTP(smtpServer, username, password)
failedRecv = smtp.sendmail(mailAcct, map(string.strip, string.split(email_to, ",")), msg)
smtp.quit()
except smtplib.SMTPServerDisconnected :
pass
except smtplib.SMTPSenderRefused :
好像有一个:esmtplib
举例:
try:
smtp = esmtplib.ESMTP(smtpServer, username, password)
failedRecv = smtp.sendmail(mailAcct, map(string.strip, string.split(email_to, ",")), msg)
smtp.quit()
except smtplib.SMTPServerDisconnected :
pass
except smtplib.SMTPSenderRefused :
#9
我的Lib目录里没有esmtplib.py呀,再说,有没有注释呀
#10
gz
#11
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('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
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('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()