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.....?
Gmail: 25 MB. However, the Gmail attachment size limit can be deceptive because Google encodes your email into a particular format before sending it. This process can double the size of your attachment; thus, the actual Gmail attachment size limit is closer to 12.5 MB. Outlook: 20 MB (on all versions).
You can send up to 25 MB in attachments. If you have more than one attachment, they can't add up to more than 25 MB. If your file is greater than 25 MB, Gmail automatically adds a Google Drive link in the email instead of including it as an attachment.
This class allows you to attach files, streams, or text to an email message. MailAddress. Represents the email address of the sender and recipients. MailMessage.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With