2012-02-15 64 views
1

大附件,我一直在試圖發送使用C#ASP.NET 3.5 System.Net.Mail大附件(9 MB)。我讀過.NET 4.0有一個不允許的錯誤,但.NET 3.5沒有問題。 .NET 4.0 Fails When sending emails with attachments larger than 3MB發送使用C#ASP.NET 3.5 System.Net.Mail

因爲.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; 

有人能幫忙嗎?謝謝。

回答

3

The server response was: 5.3.4 Error: message file too big:

,告訴你,你需要知道的一切:服務器 dissallows發送該大小的附件。有至少不會在.NET或錯誤之類的東西,因爲沒有你的代碼錯誤。您鏈接的錯誤消息與.NET中的錯誤有很大不同。這是無關的。

+0

非常感謝你。 – engg 2012-02-16 18:30:51

相關問題