TransWikia.com

Default SMTP functionality if one of multiple addresses is invalid

Server Fault Asked by freefaller on December 29, 2021

Although this is effectively a programming question, my gut feeling is that subject is more suited to this site. However, if you feel it is better suited to Stackoverflow, please let me know and I’ll ask it there instead.

Is there default functionality (or recognised standards) across SMTP relays as how they deal with a single email that has multiple addresses, where one or more of the address is invalid?

In my testing it appears that if the SMTP detects an invalid address (normally because there is no corresponding address in the corporate SMTP system I’m connecting to) then the entire email fails – nobody on the email receives it.

Can anybody confirm if this is standard functionality?

Or is it something that can be configured at an individual SMTP level?

Or is it down to the individual SMTP vendor to decide how it deals with emails where one or more addresses are invalid?

Is it ever possible that the "other" recipients would still get the email?

Notes…

  • I am a programmer, not a network administrator, so I have literally no experience of setting up or configuring SMTP relays. But I need to know how to handle those errors in my code should the SMTP I’m connected to come back with an issue.
  • This is not specific to a particular SMTP vendor, as my application must run against any SMTP relay that our client desires.

One Answer

An email may be sent to any number of recipients. If it cannot be delivered to a single address, all other addresses will still receive the message. The sender will (usually) receive one or more nondelivery notifications showing the addresses that failed and giving the reason for the failure. (A third party provider such as Sendgrid might not send NDR messages via email but show this in a web based dashboard or provide it via API instead.)

RFC 5321 specifies that you are expected to repeat the RCPT command any number of times. In practice, you will connect to the mail server for a given domain, and then attempt to deliver to every address within that domain, by sending one MAIL command, multiple RCPT commands, then DATA. If an RCPT gives an error, you log it and continue. Then after all the addresses in all the domains are attempted, you send back an NDR to the sender with the failed addresses and reasons. Note that you have to queue and try again for a 4xx error. Your best bet as a programmer is not to try to implement SMTP yourself but to just send the mail to an existing SMTP server set up as a relay that already can handle everything for you.

Answered by Michael Hampton on December 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP