Set Email Attachment name in C# with System.Web.Mail -


i add attachment this:

system.web.mail.mailattachment attachment = new system.web.mail.mailattachment(attachmentpath);     system.web.mail.mailmessage mailmsg = new system.web.mail.mailmessage(); .... mailmsg.attachments.add(attachment); 

but want make attach different name, actual file name long , confusing because temporary file. attach such "salesorderno1.pdf", there easy way without having make copy of file high risk of file name collision?

(i cannot use system.net.mail because have connect servers use implicit ssl system.net.mail not support it.)

you have rename file. if want avoid file name collisions, have temp folder copy files , rename them in there. attach new file email, send email, , regardless of successful send or not, delete file @ end of method.

regardless, deleting attachments when you're done emailing them out practice anyway unless need keep files sort of auditing purposes.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -