Programmatic mail.
WHEN YOU NEED IT
Notifications from scripts Reports delivered automatically Application messages to users
WHAT TO USE
Python's mail facilities for composing, and an authenticated connection for sending.
WHAT TO CONFIGURE
The mail server hostname The port and encryption An account on your own domain, and its password
WHERE TO GET THOSE
cPanel, under email accounts, connect devices.
WHAT TO NEVER DO
Send with the recipient's or a visitor's address as the sender.
Your server is not authorised to send as their domain, and it fails authentication.
WHAT TO DO INSTEAD
Send from your own domain and set reply-to.
WHAT ELSE MATTERS
The sending route must be covered by your mail authentication records.
WHAT TO HANDLE
Connection failure Authentication failure Rejection by the recipient
WHAT TO LOG
That the message was sent, to whom, and any failure.
Never the credentials.
WHAT TO CONSIDER FOR VOLUME
A dedicated sending service rather than your mail server.
WHAT TO TEST
Delivery to a major provider, not only to your own domain.