前提・実現したいこと
Postfixを使用してメール送信の動作確認は出来たのですが、Pythonからのメール送信にエラーが発生してしまいます。
発生している問題・エラーメッセージ
Feb 17 03:27:18 li1562-132 postfix/smtpd[8571]: connect from localhost[127.0.0.1] Feb 17 03:29:49 li1562-132 postfix/smtpd[8571]: SSL_accept error from localhost[127.0.0.1]: lost connection Feb 17 03:29:49 li1562-132 postfix/smtpd[8571]: lost connection after CONNECT from localhost[127.0.0.1] Feb 17 03:29:49 li1562-132 postfix/smtpd[8571]: disconnect from localhost[127.0.0.1]
該当のソースコード
# -*- coding: utf-8 -*- import smtplib from email.mime.text import MIMEText from_address = 'root@****.xyz' to_address = '*****@gmail.com' msg = MIMEText( "Hello!!" ) msg['Subject'] = 'Mail sending test.' msg['From'] = from_address msg['To'] = to_address s = smtplib.SMTP() s.connect() s.sendmail( me, [you], msg.as_string() ) s.close()
試したこと
Postfixからsendmailを使用して送信確認したところ、大丈夫でした。
#sendmail *****@gmail.com To:*****@gmail.com From:root@****.xyz test .
原因の分かる方がいらっしゃれば、ご教授お願い致します。
Should you have login before sendmailing?
回答3件
あなたの回答
tips
プレビュー