I have a need in my app wherein users would be forwarding specific emails to an email in my domain. I have to process them and update the data associated with each user.
Method 1: MX records pointed to SES
- When your domainβs MX records are pointed to SES, all your mail routing is handled by SES
- You can configure SES rules to trigger lambdas for specific emails
- Optionally, forward ALL other emails to Gmail using SES actions
User forwards β specific@mydomain.com β SES receives β Lambda processes mail β Updates DB
Other emails β yourdomain.com β SES receives β Forwards to Gmail β You receive normally in Gmail
Have a fallback MX record pointed to Gmail
- MX record to SES with priority 10
- MX record to Gmail with priority 20
- This way Gmail gets the emails if (and only if) SES completely fails
Method 2: Gmail API
- Use Gmail API in your Lambda to periodically check and process emails
- Trigger via CloudWatch Events every few minutes
- Periodic polling always means a tradeoff btw Polling Frequency vs Cost & Performance
Method 3: Gmail Push Notifications
- Set up Gmail webhook to your API endpoint
- Gmail notifies your endpoint instantly when new emails arrive
- Trigger Lambda immediately for processing
User forwards β Gmail receives β Gmail push notification β Your API endpoint β Triggers Lambda β Processes email via Gmail API β Updates DB β User sees update immediately
Method 4: Subdomain for SES
- Keep current Gmail setup
- Create
investments@mail.mydomain.comsubdomain for SES - Ask users to forward to the subdomain (slightly larger email ID)
- Zero risk to your main email flow
https://claude.ai/share/e8a2da4c-85cd-4543-9112-30cc34005b9b