Reputation: 97
How can i send an email with attachment in windows universal app (windows phone 8.1 and windows 8.1)
Class Windows.ApplicationModel.Email.EmailMessage
is available only for windows phone
Upvotes: 2
Views: 1767
Reputation: 35
You can use SMTP for sending email in windows 8:
SmtpMail oMail = new SmtpMail("TryIt");
oSmtp = new SmtpClient();
oMail.From = new MailAddress("[email protected]");
oMail.To.Add(new MailAddress("[email protected]"));
oMail.Subject = "Subject ";
oMail.TextBody = "Here is body";
SmtpServer oServer = new SmtpServer("smtp.gmail.com");
oServer.User = "[email protected]";
oServer.Password = "123456";
oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
await oSmtp.SendMailAsync(oServer, oMail);
Upvotes: 0
Reputation: 21899
There is no direct, in-box way to send an email in a Windows Store app.
As you note, Windows.ApplicationModel.Email is available only for Windows Phone Runtime apps. This is one of the discontinuities in Universal apps where a feature is available on one platform but not both.
Options are:
Upvotes: 3
Reputation: 74
You could use MailMessage email = new MailMessage();
from System.Net.Mail
-Namesapce
Upvotes: 0