C#发email发不出去
private System.Web.Mail.MailMessage m_Mail;
m_Mail=new MailMessage();
m_Mail.From="Michelle.Wei@cnweidmuller.com";
m_Mail.To="Michelle.Wei@cnweidmuller.com";
m_Mail.Subject="test";
m_Mail.BodyFormat=MailFormat.Html;
m_Mail.Body="hello!!!";
SmtpMail.SmtpServer="srvcn015.weidmueller.com";
SmtpMail.Send(m_Mail);
错误信息是:
The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available
Source Error:
Line 80: SmtpMail.SmtpServer="srvcn015.weidmueller.com";
Line 81:
Line 82: SmtpMail.Send(m_Mail);
Line 83:
Line 84: //Label3.Text="发送成功";
Source File: c:\inetpub\wwwroot\webapplication1\webform3.aspx.cs Line: 82
Stack Trace:
[COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available
]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args)
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
WebApplication1.WebForm3.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\webapplication1\webform3.aspx.cs:82
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
请问是什么问题啊?