标签: smtpexception

System.Net.Mail.SmtpException:系统存储不足.服务器响应如下:4.3.1系统资源不足

我最近在C#中设计了一个程序,它将从SQL数据库中提取信息,编写带有结果的HTML页面,并自动发送电子邮件.我一切都在工作[偶尔],我遇到的问题是我似乎正在崩溃我们公司的交换服务器.在程序的前几次成功运行之后,我将开始获得此异常:

基本异常:System.Net.Mail.SmtpException:系统存储不足.服务器响应如下:4.3.1系统资源不足

我想知道我是否应该在我的邮件中调用某种类似Dispose()的方法?或者,如果有任何其他明显的原因导致邮件系统停止响应?这会影响我们公司的所有客户,而不仅仅是我的代码.

这是Exchange 2010,我的代码是针对.NET 3.5编译的.我的附件通常是27kb.如果我登录到Exchange服务器,似乎消息只是无限期地挂在队列中.清除队列(删除而不发送NDR)并重新启动服务器将重新启动它.

邮件部分如下所示(用户名,密码和地址已更改):

public void doFinalEmail()
{
     List<string> distList = new List<string>();
     string distListPath = Environment.CurrentDirectory + "\\DistList.txt";
     string aLine;

     logThat("Attempting email distribution of the generated report.");

     if (File.Exists(distListPath))
     {
         FileInfo distFile = new FileInfo(distListPath);
         StreamReader distReader = distFile.OpenText();

         while (!String.IsNullOrEmpty(aLine = distReader.ReadLine()))
         {
             distList.Add(aLine);
         }
     }
     else
     {
         logThat("[[ERROR]]: Distribution List DOES NOT EXIST! Path: " + distListPath);
     }

     MailMessage msg = new MailMessage();
     MailAddress fromAddress = new MailAddress("emailaddresshere");
     msg.From = fromAddress;

     logThat("Recipients: ");
     foreach …
Run Code Online (Sandbox Code Playgroud)

c# exchange-server system.net.mail smtpexception

6
推荐指数
1
解决办法
2万
查看次数