问题原文
原帖链接 · freefaller · CC BY-SA 4.0
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.
已采纳解答
原帖链接 · B. Martin · CC BY-SA 4.0
When you have one email with multiple receivers where one is invalid, the mail server tries to send the email until it encounters the email address with the error. Then it usually sends a non-delivery notification to the sender, and it stops to process the email further.
That means you basically can't know who received the email and who didn't. The order of the email addresses that it tries to send the email to, is not guaranteed. It might take the order of the addresses in the email, or use some entirely different order.
I know this because I used to be responsible for investigating delivery issues for the biggest provider in my country.
Here is what the mail sever basically does:
- Make a list of all receivers (in an unknown order)
- Try to send email to each receiver individually
- It encounters the receiver with delivery issues
- It usually sends a non-delivery message to the sender.
- It usually stops sending the message to the remaining receivers.
There might be some mail servers that are configured differently or have different default behavior.
This is one of the mail reasons why you have to use newsletter software for sending out newsletters. They send each email individually to avoid this issue.
Delivery issues can have many reasons. Some of them are:
- invalid email syntax
- invalid user name (name before @ symbol)
- invalid hostn name
- mailbox is full
- invalid MX records (or A record if MX is not present)
- blocked sender email
- sender server is blocked
- email is recognised as spam
- recever mail server is unavailable
- misconfigured gray listing on sender mail server
Some reasons for delays are
- sender mail server has too many emails in the queue
- recever mail server temporary unavailable (e.g. too much traffic, outage)
- gray listing is used and the sender server hasn't sent email to the receiver server for a while
Some errors only occur, after the mail server has tried to send an email. Therefore, it cannot know whether the email can be delivered before it tries. That means there is basically no way a mail server can guarantee it can stop the entire delivery before it reaches the invalid receiver.
Conclusion: The right way to send emails is to always send individual emails to each email address. (That's how newsletter software does it.)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
