smtp| Error | Error handling the two days did a small project, roughly a server monitoring system, if found in a certain server abnormal, send email to the relevant mobile phone, so that in time and holidays can also be aware of the system failure.
One of the functions is to send email. The procedure is this:
mymailmsg.to = "888888888@mobile.att.net";
Mymailmsg.from = "Support@medicalit.net";
Mymailmsg.subject = "Server Down";
Mymailmsg.body = "Please call StarLAN to Chen Database Server";
Mymailmsg.bodyformat = Mailformat.text;
smtpmail.smtpserver= "localhost";
Smtpmail.send (MYMAILMSG);
was originally used with an external SMTP SERVER
Smtpmail.smtpserver= "SMTP. XXX.com ";
But later found that because of the firewall reason for data center, instead
smtpmail.smtpserver= "localhost";
Post-run system prompts for error messages:
Email Fail
Could not access ' CDO. Message ' object.
The full error message output:
System.Web.HttpException:Could not access ' CDO. Message ' object. ---> System.Reflection.TargetInvocationException:Exception has been thrown by the target of a invocation. ---> System.Runtime.InteropServices.COMException (0x8004020f): The server rejected one or more recipient addresses. The server response was:550 5.7.1 Unable to relay for 12321323@mobile.att.net
Checking the SMTP SERVICE is normal, and is estimated to be a permission setting issue. Open IIS ADMIN, right-click SMTP virtual server (Default SMTP VM), select Properties, relay (relay) in Access (access), and increase 127.0.0.1. OK go back all the way.
Then run the program and the message is sent successfully.