Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用C#ASP.NET 3.5 System.NET.Mail发送大附件_C#_Asp.net_.net 3.5_Email Attachments_System.net.mail - Fatal编程技术网

使用C#ASP.NET 3.5 System.NET.Mail发送大附件

使用C#ASP.NET 3.5 System.NET.Mail发送大附件,c#,asp.net,.net-3.5,email-attachments,system.net.mail,C#,Asp.net,.net 3.5,Email Attachments,System.net.mail,我一直在尝试使用C#ASP.NET 3.5 System.NET.Mail发送一个大附件(9 MB)。我读到.NET4.0有一个不允许这样做的bug,但是.NET3.5可以。 由于.NET 3.5在发送电子邮件后无法正确关闭会话,因此我在发送之前添加了这一行: smtpClient.ServicePoint.MaxIdleTime = 2; 线路 smtpClient.Send(email); 仍在抛出此错误: Exceeded storage allocatio

我一直在尝试使用C#ASP.NET 3.5 System.NET.Mail发送一个大附件(9 MB)。我读到.NET4.0有一个不允许这样做的bug,但是.NET3.5可以。

由于.NET 3.5在发送电子邮件后无法正确关闭会话,因此我在发送之前添加了这一行:

    smtpClient.ServicePoint.MaxIdleTime = 2; 
线路

    smtpClient.Send(email);
仍在抛出此错误:

    Exceeded storage allocation. The server response was: 5.3.4 Error: message file   too big:   
    at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse)
    at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn)
    at System.Net.Mail.SmtpConnection.OnClose(Object sender, EventArgs args)
    at System.Net.ClosableStream.Close()
    at System.Net.Mail.MailWriter.Close()
    at System.Net.Mail.SmtpClient.Send(MailMessage message)
更改编码没有帮助。这会破坏附件:

    email.Attachments[0].TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit;
有人能帮忙吗?多谢各位

服务器响应为:5.3.4错误:消息文件太大:

这将告诉您需要知道的一切:服务器允许发送该大小的附件。您的代码没有问题,至少不是因为.NET中的错误或类似的问题。您链接的与.NET中的错误相关的错误消息与您得到的消息非常不同。这是无关的

服务器响应为:5.3.4错误:消息文件太大:

这将告诉您需要知道的一切:服务器允许发送该大小的附件。您的代码没有问题,至少不是因为.NET中的错误或类似的问题。您链接的与.NET中的错误相关的错误消息与您得到的消息非常不同。这是无关的