Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This guide will help you deploy your portfolio to Netlify with a fully functiona

1. **GitHub Account** (to push your code)
2. **Netlify Account** (free at [netlify.com](https://netlify.com))
3. **Gmail App Password** (already configured: `mwwi pcqj srfr drur`)
3. **Gmail App Password** (generate one at [myaccount.google.com/apppasswords](https://myaccount.google.com/apppasswords))

---

Expand Down Expand Up @@ -101,7 +101,7 @@ Your contact form **will NOT work** without these environment variables!
| `SMTP_HOST` | `smtp.gmail.com` |
| `SMTP_PORT` | `465` |
| `SMTP_USER` | `kulharshit21@gmail.com` |
| `SMTP_PASS` | `mwwi pcqj srfr drur` |
| `SMTP_PASS` | `<your Gmail App Password>` |
| `RECIPIENT` | `kulharshit21@gmail.com` |

3. **⚠️ IMPORTANT**: After adding environment variables, you MUST redeploy:
Expand Down Expand Up @@ -156,7 +156,7 @@ Your contact form **will NOT work** without these environment variables!

### Issue 2: Emails not sending
**Solution**:
- Verify Gmail App Password is correct: `mwwi pcqj srfr drur`
- Verify Gmail App Password is correct (generate a new one at [myaccount.google.com/apppasswords](https://myaccount.google.com/apppasswords))
- Ensure `SMTP_PORT` is `465` (not 587)
- Check if Gmail account has "Less secure app access" enabled (if needed)

Expand Down
7 changes: 4 additions & 3 deletions netlify/functions/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ export async function handler(event) {
};
}

const smtpPort = +process.env.SMTP_PORT || 465;
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: +process.env.SMTP_PORT,
secure: true,
port: smtpPort,
secure: smtpPort === 465,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
Expand Down Expand Up @@ -126,7 +127,7 @@ export async function handler(event) {
body: JSON.stringify({ ok: true }),
};
} catch (error) {
console.error('Contact function error:', error);
console.error('Contact function error:', error.message ?? error);
return {
statusCode: 500,
headers,
Expand Down
5 changes: 3 additions & 2 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ const app = express();
app.use(cors());
app.use(express.json());

const smtpPort = +process.env.SMTP_PORT || 465;
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: +process.env.SMTP_PORT,
secure: true,
port: smtpPort,
secure: smtpPort === 465,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS
Expand Down