Path : /home/vishqocm/pcib.in/
File Upload :
Current File : /home/vishqocm//pcib.in/contact_email_setup.md

# Contact Form Email Setup Guide

This guide will walk you through the process of setting up your Gmail account to work with the website's contact form.

## Requirements

1. A Gmail account
2. PHPMailer installed on your server (included with the website)
3. SMTP access on your hosting

## Setting Up Gmail App Password

Since May 2022, Gmail no longer allows "less secure apps" to access your account directly with just your regular password. Instead, you need to generate an "App Password" - a 16-character code that gives a less secure app or device permission to access your Google Account.

### Step 1: Enable 2-Step Verification

Before you can create an App Password, you must enable 2-Step Verification on your Google Account:

1. Go to your [Google Account](https://myaccount.google.com/).
2. Select **Security** from the left navigation panel.
3. Under "Signing in to Google," select **2-Step Verification**.
4. Follow the on-screen steps to turn on 2-Step Verification.

### Step 2: Create an App Password

1. Go to your [Google Account](https://myaccount.google.com/).
2. Select **Security** from the left navigation panel.
3. Under "Signing in to Google," select **App passwords**.
   - Note: 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 for security keys only
     - Your account is through work, school, or other organization
     - Advanced Protection is turned on
4. At the bottom, click **Select app** and choose "Mail" or "Other" (custom name).
5. If you choose "Other", enter a name for the app password (e.g., "Website Contact Form").
6. Click **Generate**.
7. The App Password will be displayed as a 16-character code with spaces. 
8. **Copy this password** - you'll need to add it to your website's configuration.

### Step 3: Update Your Website Configuration

1. Open the file `send_contact_email.php` on your web server.
2. Locate these lines:
   ```php
   $mail->Username = '[email protected]'; // YOUR GMAIL ADDRESS
   $mail->Password = 'xxxx xxxx xxxx xxxx'; // YOUR APP PASSWORD
   ```
3. Replace `[email protected]` with your actual Gmail address.
4. Replace `xxxx xxxx xxxx xxxx` with the App Password you generated (keep the spaces).
5. Save the file.

## Testing the Contact Form

After setting up your Gmail credentials:

1. Visit your website's contact page.
2. Fill out the contact form and submit it.
3. Check your Gmail inbox to verify that the message was received.
4. Check the email's "Reply-To" field to ensure it's set to the email address entered in the contact form.

## Troubleshooting

If the contact form isn't working:

1. Check your server's PHP error logs for any error messages.
2. Temporarily set `$mail->SMTPDebug = 2;` in `send_contact_email.php` to see detailed connection information.
3. Make sure your web server allows outbound connections on port 587.
4. Verify that the App Password was entered correctly with spaces.
5. Try generating a new App Password if the current one isn't working.

## Security Considerations

- Never share your App Password with anyone.
- If you suspect unauthorized use, you can revoke App Passwords from your Google Account security settings.
- Regularly check your account's recent security events for any suspicious activity.

## Additional Resources

- [Google Help: Sign in with App Passwords](https://support.google.com/accounts/answer/185833)
- [PHPMailer Documentation](https://github.com/PHPMailer/PHPMailer)