Flask-Mail support - Platform - BlueCat Gateway - 18.6.1

Gateway Administration Guide

prodname
BlueCat Gateway
version_custom
18.6.1

The DNS Integrity Gateway includes support for Python Flask-Mail. DNS Integrity Gateway administrators and users can use Flask-Mail to send SMTP emails as part of a workflow (such as requests or notices) quickly and conveniently.

Some options of Flask-Mail can be predefined in the config.py file. The primary configurable options are as follows:

  • MAIL_SERVER : default ‘localhost’

  • MAIL_PORT : default 25

  • MAIL_USE_TLS : default False

  • MAIL_USE_SSL : default False

  • MAIL_USERNAME : default None

  • MAIL_DEFAULT_SENDER : default None

Additional options that can be uploaded or overwritten within the workflow:

List of recipients (users or admins):
  • ADMINS: no default values

Path to decoded file that contains the Flask-mail password:
  • MAIL_PASSWORD_PATH: default "ps/.email"

Attention: Once the value for the Flask-mail password path is defined, DNS Integrity Gateway will use that file by default. If the password path is not defined or the file is missing in the defined path, the value for MAIL_PASSWORD will be None.

Example:

# imports
from main_app import app
from flask_mail import Mail, Message

mail = Mail(app)
msg = Message(subject="subject_example", body="message", recipients=config.ADMINS)
mail.send(msg)