Setting Up Email App Passwords
Email App Password Setup Guide
Email Server Troubleshooting
If your flask mail server is not working, it's likely due to:
- Using a regular mail password instead of an app password
- The email address provided is not associated with the app password provided
1. Gmail App Passwords
Prerequisites:
- 2-Step Verification enabled on your Google Account
- A personal Gmail account or Google Workspace account with app passwords allowed
Steps to create:
- Go to your Google Account Security settings
- Under "Signing in to Google," select "2-Step Verification"
- At the bottom of the page, select "App passwords"
- Enter a name for the app password (e.g., "DevOpser Email")
- Click "Create"
- Copy the generated 16-character password
Important Note
Copy the app password immediately after creation. Google will only show it once, and you'll need to generate a new one if you lose it.
2. Google Workspace App Passwords
For Workspace Administrators:
- Sign in to the Google Admin console
- Go to Security > Basic settings
- Under "Less secure apps," select "Allow users to manage their access to less secure apps"
- Click "Save"
For Workspace Users:
Follow the same steps as Gmail users above once your administrator has enabled app passwords.
3. Outlook/Microsoft 365 App Passwords
Prerequisites:
- Two-step verification must be enabled on your Microsoft account
- Your organization must allow app passwords (for Microsoft 365 accounts)
Steps to create:
- Go to your Microsoft Account Security settings
- Select "More security options"
- Under "Additional security options," choose "Create a new app password"
- Enter a name for the app password
- Click "Next"
- Copy the generated app password
Important Note
Like Gmail, Microsoft will only show the app password once. Make sure to copy it immediately.
4. Using Your App Password
After generating your app password:
- Use it in place of your regular password when configuring email in your application
- Store it securely in your environment variables or secrets management system
- Never share or reuse app passwords across different applications
Security Best Practices
- Generate a unique app password for each application
- Revoke app passwords that are no longer needed
- Regularly review your active app passwords
- Store app passwords securely using environment variables or a secrets manager
5. Troubleshooting
Common Issues:
- App password not working:
- Verify 2-step verification is enabled
- Ensure you're using the entire 16-character password
- Check if app passwords are allowed by your organization
- Can't generate app password:
- Enable 2-step verification first
- Contact your IT administrator if using a work account
- Lost app password:
- Generate a new app password
- Update the password in your application
- Revoke the old app password if possible
Need Help?
Join our Slack community to connect with other developers and get help in the #support channel.