This project uses nodemailer with a free SMTP service for sending emails from the contact form.
- Visit https://ethereal.email/ and create a free account
- Copy your SMTP credentials from your Ethereal account dashboard
- Create a
.envfile in your project root with the following content:SMTP_USER=your-ethereal-email@ethereal.email SMTP_PASS=your-ethereal-password CONTACT_EMAIL=your-receiving-email@example.com - Replace the placeholder values with your actual credentials
- Enable 2-factor authentication on your Google account
- Generate an App Password at https://myaccount.google.com/apppasswords
- Create a
.envfile with:SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_SECURE=false SMTP_USER=your-gmail@gmail.com SMTP_PASS=your-16-digit-app-password CONTACT_EMAIL=your-receiving-email@example.com
- Create a
.envfile with:SMTP_HOST=smtp-mail.outlook.com SMTP_PORT=587 SMTP_SECURE=false SMTP_USER=your-outlook-email@outlook.com SMTP_PASS=your-password CONTACT_EMAIL=your-receiving-email@example.com
- Sign up at https://www.mailgun.com/
- Create a
.envfile with:SMTP_HOST=smtp.mailgun.org SMTP_PORT=587 SMTP_SECURE=false SMTP_USER=your-mailgun-smtp-username SMTP_PASS=your-mailgun-smtp-password CONTACT_EMAIL=your-receiving-email@example.com
The application uses the following environment variables:
SMTP_HOST: SMTP server hostname (optional, defaults to Ethereal)SMTP_PORT: SMTP server port (optional, defaults to 587)SMTP_SECURE: Whether to use secure connection (optional, defaults to false)SMTP_USER: Your SMTP usernameSMTP_PASS: Your SMTP passwordCONTACT_EMAIL: The email address where contact form submissions should be sent
For production use, consider:
- Using a paid SMTP service with higher sending limits (SendGrid, Amazon SES, etc.)
- Setting up proper email authentication (SPF, DKIM)
- Adding rate limiting to prevent spam
- Implementing proper error handling and logging
- Using environment variables for all sensitive configuration