The contact and subscription forms are now configured to use Django's proper email system.
In development mode (DEBUG=True), emails are printed to the console instead of being sent.
-
Enable 2-Factor Authentication on your Gmail account
-
Generate an App Password:
- Go to Google Account settings
- Security → 2-Step Verification → App passwords
- Generate a password for "Mail"
- Use this password, not your regular Gmail password
-
Set Environment Variables:
export EMAIL_HOST_USER="your-email@gmail.com"
export EMAIL_HOST_PASSWORD="your-16-character-app-password"
export DEFAULT_FROM_EMAIL="noreply@charlesperry.com"You can use other SMTP providers by setting:
export EMAIL_HOST="smtp.your-provider.com"
export EMAIL_PORT="587" # or 465 for SSL
export EMAIL_USE_TLS="true" # or "false" for SSL- SendGrid:
smtp.sendgrid.net:587 - Mailgun:
smtp.mailgun.org:587 - AWS SES:
email-smtp.region.amazonaws.com:587
To test the email functionality:
- Start the development server:
python manage.py runserver - Navigate to
/bio/contact/ - Fill out and submit the contact form
- Check the console output (in development) or your email (in production)
- Never commit email passwords to version control
- Use environment variables for all sensitive email settings
- Consider using app-specific passwords instead of main account passwords
- In production, monitor email sending logs for any issues