使用联系方式准备的烧瓶邮件。我可以在本地使用它,但是当我将其放到服务器上时,出现错误:
smtplib.py”, line 736, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (503, ‘5.5.4 Error: send AUTH command first.‘, u’demo@demo.com’)
正如我所说,当我在本地工作时没有问题,但是当我将其发送到服务器时,它不会发送邮件并且会出错。
app.py:
from flask_mail import Mail, Message
app = Flask(__name__)
app.config['MAIL_SERVER']='smtp.yandex.com.tr'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = os.environ.get('destek@destek.co')
app.config['MAIL_PASSWORD'] = os.environ.get('[password]')
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
posta = Mail(app)
msg = Message('Subject - ' + ad, sender = 'destek@destek.co', recipients = ['destek@destek.co'])
msg.body = "example"
posta.send(msg)
爱,美好的一天!