SmtpClient.Send attachment maximum size

元气小坏坏 提交于 2019-12-18 04:55:15

问题


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 SmtpClient.Send(message) method. Why the above error coming.....?


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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>


来源:https://stackoverflow.com/questions/5258939/smtpclient-send-attachment-maximum-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!