✅ Form submissions save to Supabase
✅ Backup mailto: link opens email client
Go to Supabase SQL Editor and run supabase-email-notifications.sql
In your Supabase project dashboard:
- Go to Edge Functions
- Create new function:
send-contact-email - Use this code:
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'
serve(async (req) => {
const { name, email, phone, company, message } = await req.json()
// Send email using your preferred service (SendGrid, Resend, etc.)
const emailResponse = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: {
'Authorization': `Bearer YOUR_SENDGRID_API_KEY`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
personalizations: [{
to: [{ email: 'structureailogistics@gmail.com' }],
subject: `New Quote Request from ${company}`,
}],
from: { email: 'noreply@structurelogistics.com' },
content: [{
type: 'text/plain',
value: `
New Contact Form Submission
Name: ${name}
Email: ${email}
Phone: ${phone}
Company: ${company}
Message: ${message}
Submitted via STRUCTURE website
`.trim()
}]
})
})
return new Response(JSON.stringify({ success: true }), {
headers: { 'Content-Type': 'application/json' }
})
})The form will automatically call the Edge Function.
- Install nodemailer:
npm install nodemailer- Create API route:
/app/api/send-email/route.ts
import { NextResponse } from 'next/server'
import nodemailer from 'nodemailer'
export async function POST(request: Request) {
const { name, email, phone, company, message } = await request.json()
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'structureailogistics@gmail.com',
pass: 'YOUR_APP_PASSWORD', // Generate in Gmail settings
},
})
await transporter.sendMail({
from: 'structureailogistics@gmail.com',
to: 'structureailogistics@gmail.com',
subject: `New Quote Request from ${company}`,
text: `
Name: ${name}
Email: ${email}
Phone: ${phone}
Company: ${company}
Message: ${message}
`,
html: `
<h2>New Contact Form Submission</h2>
<p><strong>Name:</strong> ${name}</p>
<p><strong>Email:</strong> ${email}</p>
<p><strong>Phone:</strong> ${phone}</p>
<p><strong>Company:</strong> ${company}</p>
<p><strong>Message:</strong> ${message}</p>
`,
})
return NextResponse.json({ success: true })
}- Update ContactForm to call API:
const response = await fetch('/api/send-email', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData),
})- Go to Zapier.com or Make.com
- Create new Zap/Scenario:
- Trigger: Supabase New Row in
contact_submissions - Action: Send Email to
structureailogistics@gmail.com
- Trigger: Supabase New Row in
- Connect your Supabase account
- Configure email template
- Done!
For Gmail App Password:
- Go to Google Account settings
- Security → 2-Step Verification (enable it)
- App Passwords → Generate new password
- Use that password in the code above
Supabase Connection:
- URL: (see your Supabase dashboard)
- Anon Key: (see your Supabase dashboard)
✅ User fills form on website
✅ Data saves to Supabase contact_submissions table
✅ Trigger fires (from SQL script)
✅ Email sent to: structureailogistics@gmail.com
✅ You get instant notification!
It's the easiest and works immediately. Let me know if you want me to implement it!