E
E
Emil Revencu2019-01-13 14:54:08
Flask
Emil Revencu, 2019-01-13 14:54:08

How to use different mail senders from the same mail domain?

from flask_mail import Mail
...
# email server
MAIL_SERVER = 'your.mailserver.com'
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_USERNAME = 'sender1.mailserver.com'
MAIL_PASSWORD = 'sender1-password'

One Sender is defined here (sender1.mailserver.com)
How can I change it to another one (sender2.mailserver.com) in the application?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2019-01-13
@pcdesign

You can simply override these parameters in the config:

app.config.update(
MAIL_SERVER = 'two.yandex.com'
MAIL_USERNAME = 'user'
)

Or keep several configs that will define settings for several mail servers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question