c# - MVC WebMail Helper - Is It Possible to Send An Email With Attachments Without Saving Them First? -
is possible?
i'm using mvc webmail helper send email form user can add attachment using file input
webmail.send( to: email.to, cc: email.cc, bcc: email.bcc, replyto: email.replyto, subject: email.subject, body: email.messagebody, filestoattach: email.attachments, isbodyhtml: email.isbodyhtml );
i filenotfound exception save attachment first, send email, go , delete it, wondering if there way avoid having that. remember in webforms possible using fileupload control , system.net.mail's attachments system. suggestions? thanks!
the source system.web.helpers.webmail.cs
http://aspnetwebstack.codeplex.com/sourcecontrol/latest#src/system.web.helpers/webmail.cs
it looks helper method supports file paths.
you'll have use mailmessage , smtpclient directly if want able send attachments file in memory.
message.attachments.add(new attachment(postedfile.stream, postedfile.name, postedfile.contenttype));
Comments
Post a Comment