SMTP_USERNAME, SMTP_PASSWORD and AHASEND_FROM in your shell or secret store. A separate Flask mail extension is not needed.
Install Flask
quick_send.py:
quick_send.py
python quick_send.py. A failure raises an exception and exits with an error.
Add a Flask Command for Your Worker
Save this asapp.py. Set AHASEND_TO=recipient@example.com for testing. The command has no public HTTP endpoint. Flask’s command support runs it with the application context active.
app.py
flask --app app send-welcome. SMTP acceptance is not inbox delivery; use delivery webhooks to track the outcome. When moving this into a queue worker, read the recipient from an authorized job, save the job result, and review uncertain submissions before retrying. SMTP has no API idempotency key.
Related Guides
- Before sending: verify your domain and create an SMTP credential.
- Connection and message rules: SMTP hosts, ports and limits, special headers, sandbox mode, retention and plan features.
- Other ways to send: REST API, AhaSend CLI, Node.js SDK and Go SDK.
- Delivery events: webhook setup and local webhook testing.

