[英]How to setup flask mail with zoho mail
I have tried what I can think of but can't get the email to be sent from my application using flask-mail with Zoho mail.我已经尝试了我能想到的但无法使用 Flask-mail 和 Zoho 邮件从我的应用程序发送电子邮件。
I've tried setting up an app password and I have tried the following examples of configuration using some of the information from their site:我尝试设置应用程序密码,并使用他们网站上的一些信息尝试了以下配置示例:
https://www.zoho.com/mail/help/pop-access.html https://www.zoho.com/mail/help/pop-access.html
app.config['MAIL_SERVER'] = 'smtp.zoho.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USE_SSL'] = True
app.config['MAIL_USERNAME'] = '_@whatever.com'
app.config['MAIL_PASSWORD'] = 'XXXXXXXXXXXX'
app.config['MAIL_SERVER'] = 'smtp.zoho.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = '__@whatever.com'
app.config['MAIL_PASSWORD'] = 'XXXXXXXXXXX'
I would expect to be able to send an email using flask-mail with my custom domain which is setup with zoho.我希望能够使用 Flask-mail 发送一封电子邮件,其中包含我使用 zoho 设置的自定义域。
Check which host of Zoho you are registered with, if you are based in Europe you will have to edit the MAIL_SEVER parameter to:检查您注册的 Zoho 主机,如果您位于欧洲,则必须将 MAIL_SEVER 参数编辑为:
app.config['MAIL_SERVER'] = 'smtp.zoho.eu'
This should solve the SMTPAuthenticationError.这应该可以解决 SMTPAuthenticationError。
For secure access head on to general setting on Zoho mail( https://mail.zoho.com/zm/#settings/general )如需安全访问,请前往 Zoho 邮件 ( https://mail.zoho.com/zm/#settings/general ) 的常规设置
My account>Security Questions我的账户>安全问题
Application-Specific Passwords > Generate new password应用程序特定密码 > 生成新密码
name your app.为您的应用命名。 It'll give you a password
它会给你一个密码
export MAIL_PASSWORD=<generated-password>
then in config.py然后在 config.py
import os
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
And when you use TLS Zoho on time of writing this uses the port 587\\当您在撰写本文时使用 TLS Zoho 时,它使用端口 587\\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.