It has made a small Project in these two days, which is roughly a Server monitoring system. If you find that a server has an exception, email to the related mobile phone, so that the system failure can be known in time in non-working hours and holidays.
One of the functions is to send email. The program is like 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);
Originally, using external SMTP Server
SMTPMAIL.SMTPSERVER = "smtp.xxx.com";
But later found because of the firewall reasons for Data Center
SMTPMAIL.SMTPSERVER = "LocalHost";
After running the system prompt error message:
Email FailCould not access 'CDO.Message' object.Here is 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 an 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
Check if SMTP Service, normal, estimate is the permission setting problem. Open IIS Admin, right-click on the SMTP Virtual Server, select Properties, point Relay in Access, increase 127.0.0.1. Always all the way.
At this time, run the program again, and the mail is successful.