USGS agent for California earthquakes
Original Prompt & Response: Don't worry! The Gmail app password setup can be confusing. Let me walk you through it step-by-step.
The app password doesn't need to be "linked" to anything specific. It's a substitute for your regular Gmail password that works only for third-party apps (like our Python script).
- Go to myaccount.google.com
- Click "Security" on the left
- Look for "2-Step Verification" - it should show "On"
- If it's off, turn it on first
- In the same Security section, look for "App passwords"
- Click on "App passwords"
- You might need to sign in again
- Select "Mail" from the dropdown (or "Other" and type "Python Script")
- Click "Generate"
- Google will show you a 16-character password like:
abcd efgh ijkl mnop
- Copy this 16-character password (including spaces, or remove them - both work)
- This is what goes in your Python script as
sender_password
email_config = {
'smtp_server': 'smtp.gmail.com',
'smtp_port': 587,
'sender_email': 'youremail@gmail.com', # Your actual Gmail address
'sender_password': 'abcd efgh ijkl mnop', # The 16-char app password
'recipient_email': 'youremail@gmail.com' # Where you want the report sent
}Create a simple test script first to make sure email works:## Troubleshooting Common Issues:
"App passwords" option not showing?
- Make sure 2-Step Verification is turned ON first
- Wait a few minutes after enabling 2-Step Verification
Authentication still failing?
- Try the app password without spaces:
abcdefghijklmnop - Make sure you're using your full Gmail address:
username@gmail.com - Double-check you copied the app password correctly
Still having issues?
- Try generating a new app password
- Make sure you're not using your regular Gmail password
Run the test script first with your details filled in. Once that works, you'll know your email setup is correct and can use the same credentials in the main earthquake agent!
What happens when you run the test script?