Back to Blog
Forwarding
Filter
Automation
Rules
Smart Email Forwarding Rules: Filter, Route, and Automate
Go beyond simple Gmail filters. Use MailHook's JSON parsing to create complex email forwarding rules based on headers, content, or attachments.
Why Basic Filters Aren't Enough
Gmail filters are great for labels, but weak for complex logic. You can't easily say: "If sender is VIP AND subject contains 'Invoice' AND attachment is PDF -> Forward to Accounting."
With Email Forwarding via MailHook + Webhooks, you can build any logic you want.
How It Works
- Ingest: MailHook receives the email.
- Process: Your script/server receives the JSON payload.
- Forward: Based on your logic, you can trigger an SMTP service (like SendGrid or AWS SES) to forward the email or attachments to the right person.
Example Logic
if (email.from.includes("@vip-client.com") && email.subject.includes("Urgent")) {
await sendEmail({
to: "ceo@company.com",
subject: `Resend: ${email.subject}`,
body: email.text
});
}
This flexibility allows you to build custom routing engines for support teams, sales leads, or personal inbox management.