ASP.NET:发送邮件失败:_COMPlusExceptionCode = -532459699

时间:2011-07-12 09:29:19

标签: asp.net

我尝试使用我的Outlook帐户发送邮件;它在IIS上部署网站之前运行良好但在部署之后总是无法发送带有此异常的邮件:_COMPlusExceptionCode = -532459699

这里是我的代码片段:

 public static void SendEmail(string _ToEmail, string _Subject, string _EmailBody)
{
    try
    {
       Application oApp = new Application();

       NameSpace oNS = oApp.GetNamespace("mapi");

        oNS.Logon(Missing.Value, Missing.Value, false, true);

        Microsoft.Office.Interop.Outlook.MailItem email = (Microsoft.Office.Interop.Outlook.MailItem)(oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem));
        email.Recipients.Add(_ToEmail);
        email.Subject = _Subject;
        email.Body = _EmailBody;
        ((Microsoft.Office.Interop.Outlook.MailItem)email).Send();

    }
    catch (System.Exception)
    {

        throw;
    }

}

任何帮助将不胜感激!

0 个答案:

没有答案