The “Contact Me” and “Leave a Reply” forms send email using SMTP via these environment variables (read in homeViews.py).
SMTP_HOST— SMTP server hostname (example:smtp.office365.com,smtp.gmail.com, etc)SMTP_PORT— usually587(STARTTLS) or465(SSL)SMTP_USER— SMTP username (usuallyfrank@fcjamison.com)SMTP_PASSWORD— SMTP/app password
If you only have IMAP settings: those are for receiving mail, not sending. You still need the SMTP host/port for sending.
SMTP_FROM— defaults tofrank@fcjamison.comSMTP_TO— defaults tofrank@fcjamison.comSMTP_USE_TLS— defaults to1(STARTTLS). Set to0to disable.SMTP_USE_SSL— defaults to0. Set to1if your provider requires SSL on connect (usually port465).SMTP_CA_FILE— path to a CA bundle file to trust (use this if your mail server uses a private/self-signed CA).SMTP_ALLOW_INVALID_CERT— dev-only escape hatch to disable certificate verification (1to enable). Do not use in production.
$env:SMTP_HOST = "mail.fcjamison.com"
$env:SMTP_PORT = "465"
$env:SMTP_USER = "frank@fcjamison.com"
$env:SMTP_PASSWORD = "YOUR_PASSWORD_OR_APP_PASSWORD"
$env:SMTP_FROM = "frank@fcjamison.com"
$env:SMTP_TO = "frank@fcjamison.com"
$env:SMTP_USE_TLS = "0"
$env:SMTP_USE_SSL = "1"Restart the Flask app after setting these.
Set the same variables in Windows “Environment Variables”, then restart VS Code and Flask.
- “From frank@fcjamison.com” requires the SMTP account/provider to allow sending as that address.
- The code sets
Reply-Toto the visitor’s email so you can reply easily. - If you get TLS verification errors mentioning
Avast Web/Mail Shieldor “SSL/TLS scanning”, your local antivirus is intercepting the SMTP connection. Disable SSL/TLS scanning for SMTP (preferred) or setSMTP_ALLOW_INVALID_CERT=1for local development only.
If your provider says “IMAP with SSL”, that often pairs with SMTP over SSL:
SMTP_HOST=mail.fcjamison.comSMTP_PORT=465SMTP_USE_SSL=1SMTP_USE_TLS=0
If that doesn’t work, the other common option is STARTTLS:
SMTP_PORT=587SMTP_USE_TLS=1SMTP_USE_SSL=0