# EmailJS Setup Guide for AMRSON Contact Form This guide will help you set up EmailJS to make your contact form fully functional. ## Step 1: Create an EmailJS Account 1. Go to [EmailJS.com](https://www.emailjs.com/) 2. Sign up for a free account 3. Verify your email address ## Step 2: Create an Email Service 1. After logging in, go to the **Email Services** section 2. Click **Add New Service** 3. Choose your email provider (Gmail, Outlook, etc.) 4. Connect your email account and grant permissions 5. Note down your **Service ID** (it will look like `service_xxxxxxx`) ## Step 3: Create an Email Template 1. Go to the **Email Templates** section 2. Click **Create New Template** 3. Set up your template with the following details: **Template Name:** AMRSON Contact Form **Subject:** New Contact Form Submission from {{from_name}} **Email Content:** ``` Hello AMRSON Team, You have received a new contact form submission: Name: {{from_name}} Email: {{from_email}} Phone: {{phone}} Message: {{message}} Please respond to this inquiry as soon as possible. Best regards, AMRSON Website ``` 4. Click **Save** 5. Note down your **Template ID** (it will look like `template_xxxxxxx`) ## Step 4: Get Your Public Key 1. Go to **Account** -> **API Keys** 2. Copy your **Public Key** (it will look like `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`) ## Step 5: Update the JavaScript Code Open `script.js` and replace the placeholder values in the contact form section: ```javascript // Replace these three values: emailjs.init("YOUR_PUBLIC_KEY"); // Replace with your actual Public Key emailjs.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', { // Replace with your actual Service ID and Template ID ``` ## Step 6: Test the Contact Form 1. Open your website in a browser 2. Fill out the contact form with test data 3. Click "Send Message" 4. Check your email inbox for the test message ## Important Notes - The free EmailJS plan allows 200 emails per month - Make sure your email template variables match the form field names: - `{{from_name}}` - from the name field - `{{from_email}}` - from the email field - `{{phone}}` - from the phone field - `{{message}}` - from the message field - If you don't receive emails, check your spam folder - For production use, consider upgrading to a paid EmailJS plan for higher limits ## Troubleshooting **"EmailJS not defined" error:** - Ensure the EmailJS CDN script is properly loaded in your HTML - Check that your Public Key is correct **No email received:** - Verify your Service ID and Template ID are correct - Check your spam/junk folder - Ensure your email service is properly connected in EmailJS **Form validation errors:** - Make sure all required fields are filled out - Verify the email address format is correct ## Security Considerations - Your Public Key is safe to expose in frontend code - Never share your Private Key - Consider adding reCAPTCHA if you receive spam submissions - Monitor your email usage to stay within limits That's it! Your contact form should now be fully functional and sending emails directly to your inbox.