Closed niftylettuce closed 5 years ago
Not with SMTP, this is only possible with LMTP where you get a separate DATA response for each RCPT. With SMTP all recipients fail or succeed at once. The correct way to handle this is to accept the messages, and then generate bounce emails for failed recipients.
Brilliant
For generating bounces you should use a checklist:
Auto-Submitted
or X-Auto-Response-Suppress
headersReceived
headers to prevent eternal loops. This also applies to normally forwarded messages. If a message has already 20-30 Received headers then something is fishyYou can check out an example for generating a bounce message from zone-mta bounce handler
@andris9 thanks for this - following up here, I think that your statement here is inaccurate:
No bounces for messages with
Auto-Submitted
orX-Auto-Response-Suppress
headers
Instead, I think we should check the following:
@andris9 Just a follow up - your Zone MTA code would result in the following bounce in Gmail:
I've fixed it on my side, and now it looks like this:
If you're curious how I fixed it, see this: https://github.com/forwardemail/free-email-forwarding/blob/cb2a2e3b6bc47740a90b2a110d868dab723cb840/index.js#L416-L511
In ForwardEmail.net - I'd like to map the responses from the email server I'm forwarding to back to the original RCPT. For example, hello@nodemailer.com gets forwarded to a@gmail.com and b@gmail.com, and test@nodemailer.com gets forwarded to c@gmail.com. If A and B are successful, but C is not, I do not want all (3) to fail. I still want the client to know that C is not successful, and for a particular reason. Is there a way to customize the callback second argument in
onData(stream, session, callback)
such that we could do something likecallback(null, { accepted: [ ... ], rejected: [ ... ], rejectedErrors: [ ... ] })
?