System.web.mail发邮件出现的错误。
在调用System.web.mail发邮件:SmtpMail.Send(mail); 的时候出现了下面的错误:
调用的目标发生了异常。,错误代码为: at OASender.DealMail.SendMail(String SenderID, String Title, ArrayList AttArr, String RecMailAdd) in e:\ftpboot\oasender\dealmail.cs:line 542
at OASender.DealMail.DealWithMail(DataRow DR) in e:\ftpboot\oasender\dealmail.cs:line 94
开始发送:09:30:16
System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.Runtime.InteropServices.COMException (0x80029C4A): 加载类型库/DLL 时出错。
--- 内部异常堆栈跟踪的结尾 ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propKey, Object propValue)
at System.Web.Mail.LateBoundAccessHelper.SetPropStatic(Object obj, String propName, Object propKey, Object propValue)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at OASender.DealMail.SendMail(String SenderID, String Title, ArrayList AttArr, String RecMailAdd) in e:\ftpboot\oasender\dealmail.cs:line 534
------解决方案--------------------我的邮件发送代码给你看看
//实例化一个邮件消息对象
string mailTo = "";、、接收邮箱
string mailForm = "";//输入发送邮箱
string password = "";//密码
if (mailForm == "" || mailTo == "")
return;
//实例化smtp客服端对象,用来发送电子邮件
System.Net.Mail.SmtpClient stmp = new SmtpClient();
stmp.Host = "smtp.gmail.com";
stmp.Port = 587;
stmp.EnableSsl = true;
//设置是否发送是否需要身份验证,如果不需要下面的credentials是不需要的
stmp.UseDefaultCredentials = false;
stmp.Credentials = new System.Net.NetworkCredential(mailForm, password);
stmp.DeliveryMethod = SmtpDeliveryMethod.Network;
MailMessage email = new MailMessage(mailForm, mailTo);
email.IsBodyHtml = true;
email.Body = "当前IP地址为:" + m_IP;
email.Subject = System.Configuration.ConfigurationSettings.AppSettings["Subject"];
//发送邮件
stmp.Send(email);
------解决方案--------------------
System.Runtime.InteropServices.COMException (0x80029C4A): 加载类型库/DLL 时出错。
似乎是系统底层有些问题。服务器上是不是新安装了什么软件或者卸载了些什么东西,或者做了什么改动