In the ASP, you can send a simple message by calling the CDONTS component, which is natural in the asp.net. The difference is that, in the. Net framework, this component is encapsulated into the System.Web.Mail namespace.
A typical mail-sending program is as follows:
<%@ Import namespace= "System.Web.Mail"%>
<script runat= "Server" >
MailMessage mail=new MailMessage ();
Mail. From= "service@brookes.com";
Mail. To= "Brookes@brookes. COM ";
Mail. Bodyformat=mailformat.text;
Mail. body= "a test SMTP mail.";
Mail. Subject= "R u OK?";
smtpmail.smtpserver= "localhost";
Smtpmail.send (mail);
</script>
Typically, the system calls the default SMTP virtual server with IIS to deliver mail. However, you will often encounter such error prompts:
The server rejected one or more recipient addresses. The server response was:550 5.7.1 Unable to relay for brookes@brookes.com
There is an important reason for this error, in addition to the possibility of an incorrect address. As mentioned above, IIS does not carry true messaging functionality, but simply borrows an "SMTP virtual server" to enable forwarding of messages. In MSDN, you have the following tips:
If the local SMTP server (included in Windows 2000 and Windows Server 2003) is behind a firewall that blocks any direct SMTP traffic (via port 25), you will need to find out if there are any smart hosts available on the network that can be used to transfer to the Internet SMTP message.
A smart host is an SMTP server that can relay outgoing e-mail messages sent directly to the Internet from an internal SMTP server. A smart host should be able to connect to both the internal network and the Internet for use as an e-mail gateway.
Open the Default SMTP virtual Server-Properties-access-relay restrictions, and you can see that this forwarding or relaying function is limited. In the Limit list, add the IP addresses of the hosts that need to use this server to resolve the issues mentioned above.
If you do not use an SMTP virtual server with IIS and use other real mail servers, such as Imail,exchange, you often encounter problems with the server needing to send a sender authentication (ESMTP). An error occurs when you use a server that needs to verify the sender identity:
The server rejected one or more recipient addresses. The server response was:550 not local host ckocoo.com, not a gateway
Previously in ASP, there was no solution to this problem, and only the CDO component (CDONTS's parent component) could be used directly:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.