David 54321
David 54321

Reputation: 728

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.

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

app.config['MAIL_SERVER'] = 'smtp.zoho.com' 
app.config['MAIL_PORT'] = 465 
app.config['MAIL_USE_SSL'] = True 
app.config['MAIL_USERNAME'] = '[email protected]' 
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'] = '[email protected]' 
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.

Upvotes: 0

Views: 919

Answers (2)

hez
hez

Reputation: 21

For secure access head on to general setting on Zoho mail(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

import os
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')

And when you use TLS Zoho on time of writing this uses the port 587\

Upvotes: 0

EQNX
EQNX

Reputation: 161

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:

app.config['MAIL_SERVER']  = 'smtp.zoho.eu'

This should solve the SMTPAuthenticationError.

Similar question link

Upvotes: 0

Related Questions