Python スクリプトでメールを送信しようとしましたが、次のエラー メッセージが表示されました。
5.7.0 must issue a starttls command first
私は使用smtplib
していますが、これは私のコードです:
import smtplib
sender = 'from@fromdomain.com'
receivers = 'to@todomain.com'
message = """From: From Person <from@fromdomain.com>
To: To Person <to@todomain.com>
Subject: SMTP e-mail test
This is a test e-mail message.
"""
try:
smtpObj = smtplib.SMTP('smtp.gmail.com')
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"
except Exception,e:
print str(e)
このエラーを解決する方法について誰かが考えているなら、私は感謝します。