[英]python smtp sendmail with TLS — Failed
我編寫了一個python腳本來發送郵件和如下代碼:
smtp = smtplib.SMTP(MYMAILSERVER, '587')
try:
smtp.set_debuglevel(1)
smtp.ehlo()
if smtp.has_extn('STARTTLS'):
smtp.starttls()
smtp.ehlo()
smtp.login(MYLOGINNAME, PASSWORD)
smtp.sendmail(FROM, TO, CONTENT)
finally:
smtp.quit()
我收到如下消息:
......
data: (354, 'Start mail input; end with <CRLF>.<CRLF>')
send: 'From: xxxx/r/nTo: yyy/r/nSubject: this is a email from tutong/r/n/r/nJust for test and pls ignore it!~_~\r\n.\r\n'
reply: '550 5.7.1 Client does not have permissions to send as this sender\r\n'
reply: retcode (550); Msg: 5.7.1 Client does not have permissions to send as this sender
data: (550, '5.7.1 Client does not have permissions to send as this sender')
send: 'rset\r\n'
reply: '250 2.0.0 Resetting\r\n'
reply: retcode (250); Msg: 2.0.0 Resetting
send: 'quit\r\n'
reply: '221 2.0.0 Service closing transmission channel\r\n'
reply: retcode (221); Msg: 2.0.0 Service closing transmission channel
Traceback (most recent call last):
File "mailsend.py", line 11, in <module>
smtp.sendmail('xxxx', 'yyy', 'From: xxxx/r/nTo: yyy/r/nSubject: this is a email from tutong/r/n/r/nJust for test and pls ignore it!~_~')
File "/usr/local/lib/python2.5/smtplib.py", line 699, in sendmail
raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (**550, '5.7.1 Client does not have permissions to send as this sender')**
我該如何解決該問題? 謝謝
好吧,我認為錯誤說明了一切? 您使用綁定到電子郵件地址的憑據。 但是您的FROM變量與帳戶說明的不同。 今天,您通常不能像過去那樣使用任何電子郵件地址作為發件人。
如果您認為並非如此。 你檢查拼寫了嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.