Your portfolio website now has a contact form, but it needs to be configured to actually send emails. Here are your options:
EmailJS is a service that lets you send emails directly from JavaScript without a backend server.
-
Sign up for EmailJS:
- Go to emailjs.com
- Create a free account
- You get 200 emails per month for free
-
Add your email service:
- Go to Email Services in your dashboard
- Click "Add New Service"
- Choose your email provider (Gmail, Outlook, etc.)
- Follow the setup instructions
-
Create an email template:
- Go to Email Templates
- Click "Create New Template"
- Use this template:
Subject: New message from {{from_name}} - {{subject}}
Name: {{from_name}}
Email: {{from_email}}
Subject: {{subject}}
Message:
{{message}}-
Get your credentials:
- Service ID: Found in Email Services
- Template ID: Found in Email Templates
- Public Key: Found in Account > API Keys
-
Update the JavaScript: In
script.js, replace these placeholders:emailjs.init('YOUR_PUBLIC_KEY'); // Line 47 emailjs.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', templateParams) // Line 67 to_name: 'Your Name' // Line 60
This opens the user's default email client with a pre-filled message.
- In
script.js, find thesetupMailtoFallback()function - Replace
your.email@example.comwith your actual email - Uncomment the function call at the bottom of the file
If you deploy to Netlify, you can use their built-in form handling.
-
Add
netlifyattribute to your form:<form class="contact-form" netlify>
-
Deploy to Netlify
-
Forms will be handled automatically
-
You'll receive emails at your registered email address
Formspree is another popular form handling service.
- Go to formspree.io
- Create a free account
- Create a new form
- Update your HTML form:
<form class="contact-form" action="https://formspree.io/f/YOUR_FORM_ID" method="POST">
For now, you can quickly test by using the mailto option:
- Open
script.js - Find line 47:
emailjs.init('YOUR_PUBLIC_KEY'); - Comment out the EmailJS code (lines 44-70)
- Uncomment the mailto fallback by adding this line at the bottom:
setupMailtoFallback();
- EmailJS: Best for a professional setup, works great
- Mailto: Simplest, opens user's email client
- Netlify Forms: Perfect if you're using Netlify for hosting
- Formspree: Good alternative to EmailJS
If you get stuck with any of these options, let me know and I can help you set it up step by step!