Open Zendesk tickets when a receipt or invoice email bounces
When a customer permanently stops receiving your receipts, invoices, or password resets, we open a support ticket and ping your team in Slack.
Poll Mailgun for new email events and tell me when a customer has stopped receiving critical transactional mail. Run this whenever Mailgun records a new message event for my sending domain.
Look only at permanent failures. Ignore deliveries, opens, clicks, and unsubscribes, and ignore temporary or soft failures that are likely to succeed on a retry, such as a full mailbox or a receiving server that is briefly unavailable. A permanent failure is one where the receiving server rejected the address outright, for example an unknown mailbox or a domain that does not resolve.
When a permanent failure comes through, use the Mailgun List Events operation to pull the surrounding context for that recipient. Gather the failure reason, the SMTP response code and message returned by the receiving server, the subject of the failed message, any tags on it, the timestamp, and any other recent events for the same recipient so I can tell whether this is a one-off or a repeated problem.
Then decide whether the failed message was transactional or marketing, judging from the subject line and the tags. Treat receipts, invoices, payment confirmations, password resets, account security notices, order confirmations, and shipping updates as transactional and customer-impacting. Treat newsletters, promotions, campaign blasts, and product announcements as marketing and skip them entirely, because a bounced newsletter is not worth a ticket. If a message is genuinely ambiguous, err on the side of treating it as transactional.
Before opening anything, use the Zendesk Search Tickets operation to check whether there is already an open ticket for the same recipient and the same delivery problem. If there is, leave it alone rather than filing a duplicate, so one customer with a broken address does not flood the queue.
For each genuinely customer-impacting failure that is not already ticketed, create a Zendesk ticket with the Create Ticket operation. The ticket should name the recipient's email address, identify the message that failed by subject and time, translate the bounce reason and SMTP response code into plain English that a support agent with no email expertise can act on, and suggest a concrete next step such as calling the customer, asking them for an alternate address, or checking whether the address has an obvious typo. Set the priority based on how critical the message was, with password resets and payment receipts ranking highest.
Once the ticket exists, post a short heads-up to our #support Slack channel using the Slack Bot Send a Message operation. Keep it to a couple of lines: who is affected, what they did not receive, and a reference to the Zendesk ticket. If nothing customer-impacting was found, do not post anything at all.
What does this prompt do?
- Watches your outgoing email for permanent delivery failures, the kind where the message will never arrive no matter how many times it is retried.
- Ignores marketing blasts and newsletters, so you only hear about the mail that actually matters: receipts, invoices, password resets, and order confirmations.
- Opens a support ticket naming the customer, the message that failed, what the failure actually means in plain English, and a suggested next step.
- Posts a short heads-up in your support channel so someone can reach out before the customer notices they never got their receipt.
What do I need to use this?
- A Mailgun account that sends your transactional email
- A Zendesk account where the support tickets should be created
- A Slack workspace with a channel for support alerts, such as #support
How can I customize it?
- Change which messages count as transactional by adjusting the subjects and tags to watch for, so you can add things like shipping updates or appointment reminders.
- Point the heads-up at a different Slack channel, or route billing failures to the finance team instead of support.
- Adjust the ticket priority and the suggested next step, for example asking for an alternate address rather than calling the customer.
FAQs
What counts as a permanent failure?
Will this create tickets every time a newsletter bounces?
Do I need to understand bounce codes to use this?
How quickly will we hear about a failed message?
Will it open a new ticket every time the same customer bounces?
Related templates
When someone leaves, we check which shared passwords they used in their final months and post a ranked rotation list to your security channel.
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
When you merge a fix in GitHub, this agent checks the matching dead-letter queue, replays the failed messages, and reports back on the pull request and in Slack.
Stop losing customers to email that never arrives.
Catch failed receipts and password resets the moment they bounce, and put a real person on it before the customer has to call you.