How to receive error messages returned by the smtp server
For example, the mail address does not exist, is it incorrect, or is not sent successfully?
Requirement: In fact, I just want to add the Invalid Address, or failed to send the email multiple times, and then add the email address to the blacklist.
N9walker: When an email is sent to the destination by the mail server, it returns an email to the sender's mailbox, but it does not return immediately. It may take a few days to return, this depends on the settings of the email server. Therefore, one way to solve this problem is to regularly check the mailbox to see whether there is a bounce message. If no email is returned within 24 or 48 hours, we confirm that the email has been sent successfully.
BrianLei: Isn't there a callback event in the smtpclient class, but I always feel that this is not the case. Then I would like to ask if there is a problem in outlook when a new user creates a new user. After creating a new user, outlook will check and receive (pop, smtp server) all the time? If there is a problem, the error message is usually returned.
N9walker: This is just a Server check. You can do the same with your code. If you cannot send emails, an exception will occur.
However, if the email server has no problem, but the email Receiving address is faulty, this will not work.
BrianLei: I am talking about the situation that "the mail server is not faulty, but the mail Receiving address is faulty ."
This cannot be done. That is to say, timely checks cannot be performed. Only 24 or 48 hours of checks can be performed, right?
N9walker: Yes, but when sending an email, there is a setting that requires the recipient to return a message. If the message is received, it is not reliable.
Generally, our applications do not handle Sending address errors. Unless you program on the mail server, we can read the dead letter directory of the mail server. If there is a dead letter, the email is certainly not sent successfully. for example, for the smtp service provided by windows, its dead mail directory is in the virtual directory of your mail server. The mail server first places the emails that cannot be published into the dead mail directory, the email will be resending at a specified time. After several times, if the email cannot be sent, the email will be deleted.
After reading the above conversation, is there any way to promptly check the situation that "the email server is not faulty, but the email Receiving address is faulty"
* The problem is urgent, and it is too slow to reply to the question area. So I am sending it to the "Homepage" for help!