Complete guide for configuring EmailJS with the Voltant Energy contact form.
EmailJS allows you to send emails directly from your frontend application without needing a backend server. It's perfect for contact forms and enquiries.
- Go to https://www.emailjs.com/
- Sign up for a free account
- Verify your email address
- In your EmailJS dashboard, go to "Email Services"
- Click "Add New Service"
- Choose your email provider (Gmail, Outlook, etc.)
- Follow the setup instructions for your provider
- Note down the Service ID
- Go to "Email Templates" in your dashboard
- Click "Create New Template"
- Use this template structure:
Subject: New Contact Form Submission from {{from_name}}
From: {{from_name}}
Email: {{from_email}}
Message:
{{message}}
---
This email was sent via the Voltant Energy website contact form.
Reply-To: {{reply_to}}
- Note down the Template ID
- Go to "Account" → "General"
- Find your Public Key (also called User ID)
Update the .env file with your actual values:
VITE_EMAILJS_SERVICE_ID=service_xxxxxxx
VITE_EMAILJS_TEMPLATE_ID=template_xxxxxxx
VITE_EMAILJS_PUBLIC_KEY=xxxxxxxxxxxxxxxThe contact form sends these variables to your EmailJS template:
| Variable | Description |
|---|---|
from_name |
User's name from the form |
from_email |
User's email from the form |
message |
User's message from the form |
to_name |
"Voltant Energy" (customizable) |
reply_to |
User's email for easy replies |
- Save your
.envfile with the correct values - Restart your development server
- Test the contact form
- Check your email inbox for the test message
You can also use the provided test script:
pnpm test:emailjs- 200 emails per month
- EmailJS branding in emails
- Basic support
- More emails per month
- Remove EmailJS branding
- Priority support
- Advanced features
- Your EmailJS public key is safe to expose in frontend code
- Never expose your private key
- Set up domain restrictions in EmailJS dashboard for production
- Consider rate limiting to prevent spam
| Issue | Solution |
|---|---|
| Emails not sending | Check browser console for errors |
| Invalid credentials | Verify environment variables are set correctly |
| Service not configured | Ensure EmailJS service is properly set up |
| Missing emails | Check spam folder for test emails |
| Domain blocked | Verify domain restrictions in EmailJS dashboard |
// Contact form automatically handles EmailJS integration
import { ContactForm } from '../components/forms';
<ContactForm onClose={() => setShowForm(false)} />Related Documentation: