我得程序是这样写的:
private void btnLogin_Click(object sender, System.EventArgs e)
{SmtpMail.Send(txtEMail.Text,txtEMail.Text, "test", "this is a test");
}
运行后系统提示:异常详细信息: System.Runtime.InteropServices.COMException: “SendUsing”配置值无效。
应该怎么改亚?
private void btnLogin_Click(object sender, System.EventArgs e)
{SmtpMail.Send(txtEMail.Text,txtEMail.Text, "test", "this is a test");
}
运行后系统提示:异常详细信息: System.Runtime.InteropServices.COMException: “SendUsing”配置值无效。
应该怎么改亚?
解决方案 »
- 如何使IE的叉叉关闭按钮无效
- 在页面左边有个TreeView控件,如何实现单击TreeView得节点,页面右边得内容随之变换,类似与CSDN得社区
- 请教关于多线程问题?
- myBlogV1.2.0发布了
- 求够邮件管理系统 开源代码
- 頁面刷新 一個複雜的問題
- aspnetpager分页
- 静态,非静态成员的问题!
- 请用freetextbox的朋友,帮忙解决一个freetextbox的显示问题,在freetextbox显示数据时,会有第二,三行显示有问题,有缺行问题
- 如何在GridView的列标题上面,再加一个标题?
- web.config的自定义错误的问题???
- 一场游戏一场梦(http://eu.webmatrixhosting.net/jxfun2/lyb.aspx)
mailMsg .From = "[email protected]";
mailMsg .To = "[email protected]";
mailMsg .Cc = "[email protected]"";
mailMsg .Bcc = "[email protected]";
mailMsg .Subject = "SubjectOfTheMailString";
mailMsg .Body = "BodyOfTheMailString";
SmtpMail.Send(mailMsg );
2. Direct method.public static void Send(string from , string to, string subject, string messageText); rameters Description:
from: Email address of sender
to: Email address of recipient
subject: Email subject line.
messageText: Body of Email message Example:SmtpMail.Send("[email protected]", "[email protected]", "Subject", "Message body");
[COMException (0x80040220): “SendUsing”配置值无效。
][TargetInvocationException: 调用的目标发生了异常。]
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): 未能访问“CDO.Message”对象。]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject, String messageText)
System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText)
app.WebForm1.btnLogin_Click(Object sender, EventArgs e) in i:\yan\asp\app\webform1.aspx.cs:53
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() +1263
怎么回事亚,我用了using System.Web.Util;
程序是这样写的:
private void btnLogin_Click(object sender, System.EventArgs e)
{SmtpMail.Send("[email protected]","[email protected]", "test", "this is a test");}
那里出问题了?是SMPT配置吗?应怎样改?
using System.Web.Mail;
public struct SendMail
{
public String FROM;
public String TO;
public String CC;
public String BCC;
public String Subject;
public String BodyFormat;
public String Body;
public MailAttachment Attachment;
}public bool MailMe(SendMail mail)
{
MailMessage msgMail;
msgMail=new MailMessage();
if ((mail.FROM=="")||(mail.FROM==null))
{
return false;
}
if ((mail.TO=="")||(mail.TO==null))
{
return false;
}
if ((mail.BodyFormat=="")||(mail.BodyFormat==null))
{
msgMail.BodyFormat=MailFormat.Html;
}
else
{
msgMail.BodyFormat=MailFormat.Html;
if (mail.BodyFormat.ToLower()=="html")
{
msgMail.BodyFormat=MailFormat.Html;
}
if(mail.BodyFormat.ToLower()=="text")
{
msgMail.BodyFormat=MailFormat.Text;
}
}
if((mail.CC!="")&&(mail.CC!=null)) msgMail.Cc=mail.CC.ToLower();
if((mail.BCC!="")&&(mail.BCC!=null)) msgMail.Bcc=mail.BCC.ToLower();
msgMail.To=mail.TO.ToLower();
msgMail.From=mail.FROM.ToLower();
msgMail.Subject=mail.Subject;
msgMail.Body=mail.Body;
if (mail.Attachment!=null) msgMail.Attachments.Add(mail.Attachment);
SmtpMail.SmtpServer="smarthost";
SmtpMail.Send(msgMail);
return true;
}
SendMail sm=new SendMail();
sm.FROM=...
sm.TO=...
sm.Body=...
sm.Subject=....
MailMe(sm); 你可以在以下MSDN网页找到更多信息:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebMailSmtpMailClassSendTopic.asp
程序如下:SmtpMail.SmtpServer="birdy";
SmtpMail.Send("[email protected]","[email protected]", "test", "this is a test");系统提示:
服务器拒绝了一个或多个收件人地址。服务器响应为: 550 5.7.1 Unable to relay for [email protected]
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Runtime.InteropServices.COMException: 服务器拒绝了一个或多个收件人地址。服务器响应为: 550 5.7.1 Unable to relay for [email protected]
堆栈跟踪:
[COMException (0x8004020f): 服务器拒绝了一个或多个收件人地址。服务器响应为: 550 5.7.1 Unable to relay for [email protected]
][TargetInvocationException: 调用的目标发生了异常。]
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): 未能访问“CDO.Message”对象。]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject, String messageText)
System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText)
app.WebForm1.btnLogin_Click(Object sender, EventArgs e) in i:\yan\asp\app\webform1.aspx.cs:59
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() +1263
那位大侠帮忙解决一下。