一个简单的C#发送WebMail的问题
首先想问下:
CDONETS.DLL组建是用在asp中的吗.那么.net,aspx就不需要添加这个组建了吗.
其次呢,
我写了一个MailSend.aspx的文件,发MAIL用的.
源代码如下:
<% @Page Language= "C# " %>
<% @Import Namespace= "System.Web.Mail " %>
<%
MailMessage msgMail = new MailMessage();
msgMail.To = "gaoyawen@163.com ";
msgMail.From = "amoonruning@sina.com.cn ";
msgMail.Subject = "Hi Chris,sss ";
msgMail.BodyFormat = MailFormat.Html;
string strBody = " <html> <body> helloworld <br> asp.net </body> </html> ";
msgMail.Body = strBody;
// SmtpMail.SmtpServer = "smtp.sina.com.cn ";
SmtpMail.Send(msgMail);
Response.Write( "Email was queued to disk ");
%>
如果屏蔽掉SmtpMail.SmtpServer = "smtp.sina.com.cn ";这句话,就报错,说“SendUsing”配置值无效。
可是如果加上这句话,就报错: "服务器拒绝了一个或多个收件人地址。服务器响应为: 554 <unknown[218.65.95.189]> : Client host rejected: Access denied "
请高手解答.
------解决方案--------------------cs文件里面添加一句
using System.Web.Mail