Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 240
Ramesh.kbvr Avatar asked Mar 10 '11 11:03

Ramesh.kbvr


People also ask

What is the maximum size for email attachment?

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).

How many size sent to mail?

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.

What is Net mail SmtpClient?

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.


2 Answers

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.

like image 163
Albin Sunnanbo Avatar answered Sep 20 '22 19:09

Albin Sunnanbo


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

like image 20
Bliminse Avatar answered Sep 18 '22 19:09

Bliminse