5.4 KiB
EmailJS Setup Guide for PTSAerial
I've switched your website back to EmailJS, which is much easier and more reliable than AWS SES for frontend forms. Here's how to set it up:
1. Create EmailJS Account
- Go to EmailJS.com
- Sign up for a free account (200 emails/month)
- Verify your email address
2. Add Email Service
- In your EmailJS dashboard, click "Email Services"
- Click "Add New Service"
- Choose "Gmail" (recommended) or your email provider
- For Gmail:
- Enter your Gmail email (could be oli@ptslondon.co.uk if it's Gmail)
- Or create a dedicated Gmail account for website emails
- Follow the OAuth setup process
- Copy your Service ID (you'll need this)
3. Create Email Templates
Template 1: Quote Request Template
- Go to "Email Templates" → "Create New Template"
- Template ID:
quote_template - Subject:
New Quote Request - PTSAerial - {{service_type}} - Content:
New Quote Request from PTSAerial Website
Customer Details:
Name: {{customer_name}}
Email: {{customer_email}}
Phone: {{customer_phone}}
Company: {{customer_company}}
Project Details:
Service Type: {{service_type}}
Location: {{project_location}}
Preferred Date: {{preferred_date}}
Budget Range: {{budget_range}}
Project Description:
{{project_description}}
---
Reply to this email to respond directly to the customer.
Website: PTSAerial.co.uk
Template 2: Contact Form Template
- Create another template
- Template ID:
contact_template - Subject:
New Contact Message - PTSAerial - {{message_subject}} - Content:
New Contact Message from PTSAerial Website
From: {{customer_name}}
Email: {{customer_email}}
Subject: {{message_subject}}
Message:
{{message_content}}
---
Reply to this email to respond directly to the customer.
Website: PTSAerial.co.uk
4. Get Your Configuration
- In EmailJS dashboard, go to "Account"
- Copy your Public Key (also called User ID)
- You'll also need your Service ID from step 2
5. Update Your Website
In your script.js file, replace these values:
// Line ~69: Replace YOUR_PUBLIC_KEY
emailjs.init("YOUR_PUBLIC_KEY"); // Replace with your actual public key
// Line ~83 and ~127: Replace YOUR_SERVICE_ID
sendEmail('quote_template', templateParams)
// Should become:
emailjs.send('YOUR_SERVICE_ID', 'quote_template', templateParams)
Example:
emailjs.init("user_abc123def456"); // Your public key
// and
return emailjs.send('service_gmail_xyz789', templateId, templateParams)
6. Test Your Setup
- Save your script.js file with the correct keys
- Open your website
- Fill out both forms (quote and contact)
- Check oli@ptslondon.co.uk for emails
- Check browser console (F12) for any errors
7. EmailJS Dashboard Monitoring
After testing, check your EmailJS dashboard:
- "History" tab shows sent emails
- Monitor your monthly usage
- Check for any failed sends
Configuration Summary
What you need to replace in script.js:
// Replace this line:
emailjs.init("YOUR_PUBLIC_KEY");
// With:
emailjs.init("your_actual_public_key");
// And replace this line:
return emailjs.send('YOUR_SERVICE_ID', templateId, templateParams)
// With:
return emailjs.send('your_actual_service_id', templateId, templateParams)
Email Template Variables
The website sends these variables to your templates:
Quote Form (quote_template):
{{customer_name}}- Customer's name{{customer_email}}- Customer's email{{customer_phone}}- Phone number{{customer_company}}- Company name{{service_type}}- Selected service{{project_location}}- Project location{{preferred_date}}- Preferred date{{budget_range}}- Budget range{{project_description}}- Project description
Contact Form (contact_template):
{{customer_name}}- Customer's name{{customer_email}}- Customer's email{{message_subject}}- Message subject{{message_content}}- Message content
Troubleshooting
Common Issues:
- "EmailJS not loaded" - Check the script tag in index.html
- "Template not found" - Ensure template IDs match exactly
- "Service not found" - Check your Service ID is correct
- Emails not arriving - Check spam folder first
Testing in Console:
Open browser console (F12) and run:
emailjs.send('your_service_id', 'quote_template', {
customer_name: 'Test User',
customer_email: 'test@example.com',
service_type: 'Aerial Photography'
});
Benefits of EmailJS vs AWS SES
✅ Easier Setup: No AWS account or IAM configuration needed
✅ Frontend Friendly: Designed for browser use
✅ No CORS Issues: Works directly from any website
✅ Free Tier: 200 emails/month is usually sufficient
✅ Template Management: Easy visual template editor
✅ Reliable Delivery: Built-in email service integration
Free Tier Limits
- 200 emails per month
- Basic templates
- Email history tracking
For higher volume, upgrade to paid plans starting at $15/month.
Quick Setup Checklist:
- Create EmailJS account
- Add Gmail service and get Service ID
- Create quote_template and contact_template
- Get Public Key from Account settings
- Update script.js with your keys
- Test both forms
- Check oli@ptslondon.co.uk for emails
The setup should take about 15 minutes and is much more reliable than AWS SES for website forms!