c# - When when sending an email of zip file size 19mb its not sending the email? -


this in new class top:

mailmessage photosmessage; 

this method have in new class:

public void sendphotos(string filenametosend)         {             try             {                 mailaddress = new mailaddress("chocolade@gmail.com", "user " + (char)0xd8 + " name",                 system.text.encoding.utf8);                 mailaddress = new mailaddress("myeimalofmyinternet");                 photosmessage = new mailmessage(from, to);                 photosmessage.body = "please check log file attachment have bugs.";                 string somearrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });                 photosmessage.body += environment.newline + somearrows;                 photosmessage.bodyencoding = system.text.encoding.utf8;                 photosmessage.subject = "log file checking bugs" + somearrows;                 photosmessage.subjectencoding = system.text.encoding.utf8;                 attachment myattachment = new attachment(filenametosend, mediatypenames.application.octet);                 photosmessage.attachments.add(myattachment);                 smtpclient docsend = new smtpclient("smtp.gmail.com", 587);                 docsend.sendcompleted += new sendcompletedeventhandler(docsend_sendcompleted);                 docsend.enablessl = true;                 docsend.timeout = 10000;                 docsend.deliverymethod = smtpdeliverymethod.network;                 docsend.usedefaultcredentials = false;                 docsend.credentials = new networkcredential("gmailusername", "gmailpassword");                 string userstate = "test message1";                 docsend.sendasync(photosmessage, userstate);                 sendlogfile.enabled = false;             }              catch (exception errors)             {                 logger.write("error sending message :" + errors);             }         } 

im using method in form1 this:

se.sendphotos(outputtext+"\\"+"textfiles.zip"); se.sendphotos(outputphotos + "\\" + "photofiles.zip"); 

firsrt time sending zipped file of text files inside zip file 5kb sending zip file no problems.

then sending zip file of 19mb inside there images/photos each photos 7.55mb time zip file never email.

the first zip file of text files second 1 never it. im using gmail email account send files regular isp email account.

i know in gmail cant send more 25mb zip file of photos 19mb

what else reason never second zip file ?

edit:

i think know problem. when getting , creating zip of text file did filter ".txt" when doing photos zip file did ".*" files:

string[] photosfiles = directory.getfiles(s, "*.*", searchoption.alldirectories); 

the result had file .ini in zip file.

how can filter images types ?

string[] photosfiles = directory.getfiles(s, "*.jpg", searchoption.alldirectories); 

this work jpg files if want png or bmp ?

for added question (in edit), can use following code files want:

 string[] extensions = {"*.bmp","*.jpg","*.png", "*.gif" };//add extensions want filter first  var filenames = extensions.selectmany(x => directory.getfiles(s, x)); 

hope helps.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -