# Setting Up Gmail for Contact Form Emails
This document provides step-by-step instructions for setting up your Gmail account to send contact form emails from your website.
## Prerequisites
1. A Gmail account ([email protected])
2. Access to your website files
## Step 1: Enable 2-Step Verification
For security reasons, Google requires 2-Step Verification to be enabled before you can create App Passwords.
1. Go to your [Google Account](https://myaccount.google.com/)
2. In the navigation panel, select **Security**
3. Under "Signing in to Google," select **2-Step Verification**
4. Follow the steps to turn on 2-Step Verification
## Step 2: Create an App Password
App Passwords allow your website to send emails through Gmail while maintaining security.
1. Go to your [Google Account](https://myaccount.google.com/)
2. Select **Security**
3. Under "Signing in to Google," select **App passwords**
- If you don't see this option, it might be because:
- 2-Step Verification is not set up for your account
- 2-Step Verification is set up but not enabled
- Your account is through work, school, or another organization
4. At the bottom, select **Select app** and choose **Other (Custom name)**
5. Enter a name like "Popular Computer Website Contact Form"
6. Click **Generate**
7. The App Password will be displayed - a 16-character code with no spaces
8. Copy this password
## Step 3: Update Your Website Configuration
1. Open the file `includes/mail_config.php` in your website files
2. Find the following section:
```php
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'YOUR_APP_PASSWORD'; // SMTP password (use App Password from Gmail)
```
3. Replace `YOUR_APP_PASSWORD` with the 16-character App Password you generated
4. Save the file
## Step 4: Test the Configuration
1. Visit your website and send a test message through the contact form
2. Check if the email arrives at [email protected]
3. If there are any issues, check your website's error logs
## Troubleshooting
If emails are not being sent:
1. Verify your App Password was entered correctly (without spaces)
2. Check that the SMTP settings in `mail_config.php` are correct
3. Make sure your hosting provider allows outgoing SMTP connections
4. Check your website's error logs for specific error messages
5. Try accessing the test script at `/temp/test_contact_email.php` to diagnose issues
## Security Considerations
- Never share your App Password with anyone
- If you suspect your App Password has been compromised, you can revoke it from your Google Account
- Regularly review the "Security" section of your Google Account for any unauthorized activity
## Additional Gmail Settings
You may need to adjust these Gmail settings for optimal functionality:
1. In Gmail settings, make sure POP/IMAP access is enabled
2. Check the "Less secure app access" settings (though this is less relevant with App Passwords)
3. If you still have problems, temporarily disable any Gmail security features that might be blocking the connection
For more information, refer to [Google's official documentation](https://support.google.com/accounts/answer/185833)