Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.Net.Mail - Trying to send a mail with attachment to gmail, works but for small attachments only
    primarykey
    data
    text
    <p>I use this class to send mails trough a gmail account:</p> <pre><code>public class GmailAccount { public string Username; public string Password; public string DisplayName; public string Address { get { return Username + "@gmail.com"; } } private SmtpClient client; public GmailAccount(string username, string password, string displayName = null) { Username = username; Password = password; DisplayName = displayName; client = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(Address, password) }; } public void SendMessage(string targetAddress, string subject, string body, params string[] files) { MailMessage message = new MailMessage(new MailAddress(Address, DisplayName), new MailAddress(targetAddress)) { Subject = subject, Body = body }; foreach (string file in files) { Attachment attachment = new Attachment(file); message.Attachments.Add(attachment); } client.Send(message); } } </code></pre> <hr> <p>Here is an example of how I use it:</p> <pre><code>GmailAccount acc = new GmailAccount("zippoxer", "******", "Moshe"); acc.SendMessage("zippoxer@gmail.com", "Hello Self!", "like in the title...", "C:\\822d14ah857.r"); </code></pre> <p>The last parameter in the <strong>SendMessage</strong> method is the location of an attachment I want to add.</p> <p>I tried sending a mail with an attachment of 400KB, worked great (even 900KB works). But then I tried uploading an attachment of 4MB, didn't work. Tried 22MB -> didn't work too.</p> <p>There should be a limit of 25MB per message in Gmail. My message's subject and body are almost empty so don't consider them as part of the message's size. Why do I have that low limit?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload