开发者

SmtpClient.Send attachment maximum size

I am trying to send attachment mails in asp.net pages using SmtpClient.Send() method. It is working fine with 2mb files. When i tried with 7mb attachment file, it is saying:

Failure sending mail.

What is the max size for sending mail using SmtpCli开发者_StackOverflow社区ent.Send(message) method. Why the above error coming.....?


The documentation for SmtpClient or MailMessage does not say anything about size limits. Most likely this is enforced by your SMTP server. You should check your SMTP server configuration for size limits.


I just happened to come across this same error and I found this URL with useful information:

http://connect.microsoft.com/VisualStudio/feedback/details/544562/cannot-send-e-mails-with-large-attachments-system-net-mail-smtpclient-system-net-mail-mailmessage

Apparently there's a flaw in the .NET 4 Framework which makes mail sending fail whenever there's an attachment bigger than 3MB.

If you apply the patch provided on the link above you supposedly fix the problem.

Hope it was helpful


That depends upon your mail sending provider that is if you are using Gmail then it will be 10 MB.

This may also be happened if while attaching the file your connection had been interrupted.


you can inc the size in config file

<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
    <httpRuntime maxRequestLength="1048576" />
    <customErrors m

  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>
  </system.webServer>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜