fix: switch contact form to use local SMTP (Maddy) instead of Mailgun

Changed contact form email delivery to use local Maddy SMTP server for better reliability.

**Changes:**
- Created new SMTP service (lib/smtp.ts) using nodemailer
- Configured to use localhost:25 (Maddy SMTP)
- Updated contact API to use smtpService instead of mailgunService
- Installed nodemailer and @types/nodemailer

**Benefits:**
- Simpler configuration (no external API dependencies)
- Local email delivery (more reliable for internal emails)
- No API rate limits or authentication issues
- Direct delivery to contact@biblical-guide.com

**Roundcube still uses Mailgun SMTP** for outgoing emails from webmail interface.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-10 14:05:16 +00:00
parent 30132bb534
commit 9158ffa637
4 changed files with 1521 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import { NextRequest, NextResponse } from 'next/server'
import { mailgunService } from '@/lib/mailgun'
import { smtpService } from '@/lib/smtp'
import { z } from 'zod'
export const runtime = 'nodejs'
@@ -46,8 +46,8 @@ export async function POST(request: NextRequest) {
}, { status: 400 })
}
// Send email using Mailgun
const emailResult = await mailgunService.sendContactForm({
// Send email using local SMTP server (Maddy)
const emailResult = await smtpService.sendContactForm({
name,
email,
subject,