4.5 KiB
4.5 KiB
AWS SES Setup Instructions
To enable email functionality for your PTSAerial contact forms using AWS SES, follow these steps:
1. AWS SES Setup
Verify Email Addresses
- Log into your AWS Console
- Go to Amazon SES service
- Navigate to "Verified identities"
- Add and verify these email addresses:
oli@ptslondon.co.uk(recipient)noreply@ptslondon.co.uk(sender - must be from your domain)
Domain Verification (Recommended)
- In SES, go to "Verified identities"
- Click "Create identity" > "Domain"
- Enter
ptslondon.co.uk - Follow DNS verification steps
- This allows sending from any address @ptslondon.co.uk
2. Create IAM User for Website
Create IAM Policy
- Go to IAM service in AWS Console
- Click "Policies" > "Create policy"
- Use JSON editor and paste:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "*"
}
]
}
- Name it
PTSAerial-SES-Send-Policy
Create IAM User
- Go to "Users" > "Create user"
- Username:
ptsaerial-website - Attach the policy you just created
- Create access keys for "Application running outside AWS"
- Save the Access Key ID and Secret Access Key securely
3. Update JavaScript Configuration
In your script.js file, update these values:
const awsConfig = {
region: 'eu-west-1', // Your SES region (e.g., us-east-1, eu-west-1, us-west-2)
accessKeyId: 'YOUR_ACCESS_KEY_ID', // From IAM user
secretAccessKey: 'YOUR_SECRET_ACCESS_KEY', // From IAM user
};
And update the sender email:
Source: 'noreply@ptslondon.co.uk', // Must be verified in SES
4. SES Sandbox vs Production
If in Sandbox Mode (default):
- Can only send to verified email addresses
- Limited to 200 emails per day
- Maximum 1 email per second
To Move to Production:
- In SES console, click "Request production access"
- Fill out the form explaining your use case
- AWS will review (usually approved within 24 hours)
- Production allows sending to any email address
5. Security Considerations
For Production Use (More Secure):
Instead of putting credentials in the frontend, consider:
-
API Gateway + Lambda (Recommended):
- Create a Lambda function to send emails
- Use API Gateway to expose an endpoint
- Call the API from your website
- Credentials stay server-side
-
Cognito Identity Pools:
- Use temporary credentials
- More secure than permanent access keys
Basic Frontend Implementation:
For testing/simple use, the current implementation works but:
- Access keys are visible in the browser
- Only use this for low-security scenarios
- Consider IP restrictions in IAM policy
6. Test Configuration
- Update the configuration values in
script.js - Ensure SES is out of sandbox mode OR oli@ptslondon.co.uk is verified
- Test both contact forms
- Check oli@ptslondon.co.uk for emails
- Monitor AWS SES console for send statistics
7. Monitoring & Troubleshooting
SES Console Monitoring:
- Check "Sending statistics" for delivery rates
- Review "Suppression list" for bounced emails
- Monitor "Reputation metrics"
Common Issues:
- Invalid sender: Ensure sender email is verified
- Access denied: Check IAM permissions
- Sandbox restrictions: Verify recipient or request production access
- Region mismatch: Ensure correct region in config
Browser Console Errors:
Check for:
- AWS SDK loading errors
- CORS issues (not applicable for SES)
- Network connectivity
- Invalid credentials
8. Email Content Details
Quote Request Emails Include:
- Customer name, email, phone, company
- Service type and location
- Preferred date and budget range
- Detailed project description
- HTML formatted table for easy reading
Contact Form Emails Include:
- Customer name, email, subject
- Message content
- Professional HTML formatting
9. Cost Information
AWS SES Pricing (as of 2025):
- First 62,000 emails per month: $0.10 per 1,000 emails
- Additional emails: $0.10 per 1,000 emails
- No monthly fees
- Very cost-effective for business use
10. Regional Recommendations
Choose your region based on:
- eu-west-1 (Ireland): Good for UK business
- us-east-1 (N. Virginia): Lowest cost, highest feature availability
- eu-west-2 (London): UK data residency if required
Your current configuration uses eu-west-1 which is ideal for UK operations.