-
Notifications
You must be signed in to change notification settings - Fork 97
Receiving bounce notifications
Andris Reinman edited this page Sep 6, 2016
·
3 revisions
ZoneMTA can send notifications about bounced messages (immediately after hard bounce or after several retries for soft bounce) by the usual email notification (a bounce message is sent to MAIL FROM address) and to a HTTP url.
If you want to receive the HTTP notifications, define an URL for bounces.url
. Once a bounce happens a POST request using content type application/x-www-form-urlencoded
is made against that url with the following POST arguments:
- id is the Queue ID
- to is the recipient address that failed with a bounce
- seq is the recipient ID for this message (the same message can have multiple recipients)
- returnPath is the sender address
- category is a string suggesting the reason for bouncing
- response is the error message received from the SMTP server
Example bounce handler in Express.js
server.post('/test-bounce', function(req, res) {
console.log('Failed sending from %s to %s. Server responded with "%s"',
req.body.returnPath, req.body.to, req.body.response);
res.send('OK');
});