c# - Send email with attach file WinRT -
i need send email log file windows phone 8.1 app. found way :
var mailto = new uri("mailto:?to=recipient@example.com&subject=the subject of email&body=hello windows 8 metro app."); await windows.system.launcher.launchuriasync(mailto);
is there special parameter specify attach file or completly different way ?
you should able use emailmessage class this. sample code can this:
private async void sendbtn_click(object sender, routedeventargs e) { emailmessage email = new emailmessage { subject = "sending test file" }; email.to.add(new emailrecipient("mymailbox@mail.com")); // create sample file send storagefile file = await applicationdata.current.localfolder.createfileasync("testfile.txt", windows.storage.creationcollisionoption.replaceexisting); await fileio.writetextasync(file, "something inside file"); email.attachments.add(new emailattachment(file.name, file)); // add attachment await emailmanager.showcomposenewemailasync(email); // send email }
Comments
Post a Comment