SmtpClient. Send max application size

I am trying to send email attachments on asp.net pages using the SmtpClient.Send() method. It works great with 2 MB files. When I tried with the 7mb attachment file, it says:

Failure to send mail.

What is the maximum size for sending mail using the SmtpClient.Send(message) method. Why is the error above ??

+6
c # smtpclient
source share
5 answers

The documentation for SmtpClient or MailMessage says nothing about sizes. This is most likely provided by your SMTP server. You must check the configuration of your SMTP server for size restrictions.

+8
source share

Are you using an x64 machine? If so, there is a fix for this problem -> https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30226 Try it, maybe this will solve your problem.

+5
source share

I just came across this 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

Obviously, there is a flaw in the .NET 4 Framework, which makes sending mail unsuccessful when there is an application larger than 3 MB.

If you apply the patch indicated in the link above, you are supposed to fix the problem.

Hope this was helpful

+4
source share

It depends on your mail sending provider, if you use Gmail, then it will be 10 MB.

This can also happen if your connection was disconnected while attaching a file.

0
source share

you can specify the size in the configuration 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
source share

All Articles