简体   繁体   English

从Windows Phone 8.1发送电子邮件

[英]Send email from windows phone 8.1

I want to sent an email from windows phone 8.1 app.Email Compose task not working in it. 我想发送一封来自windows phone 8.1 app.Email Compose任务的电子邮件。 I tried this 我试过这个

EmailRecipient sendTo = new EmailRecipient()
{
    Address = "abc@outlook.com"
};

//generate mail object
EmailMessage mail = new EmailMessage();
mail.Subject = "Feedback";


//add recipients to the mail object
mail.To.Add(sendTo);
//mail.Bcc.Add(sendTo);
//mail.CC.Add(sendTo);

//open the share contract with Mail only:
await EmailManager.ShowComposeNewEmailAsync(mail);

This gives an error in the emulator: 这会在模拟器中出错:

Can't share 不能分享
There are no apps to share with. 没有可与之分享的应用。

You don't have any Email accounts in your emulator to share from that account. 您的模拟器中没有任何电子邮件帐户可以与该帐户共享。 If you want to send an email, you should have an account right? 如果您想发送电子邮件,您应该拥有一个帐户吗?

So go to email + accounts in Settings menu and add an account of any type in Emulator. 因此,请转到设置菜单中的电子邮件+帐户 ,然后在模拟器中添加任何类型的帐户。 Once you finish adding an email account, try deploying the app in the Emulator and perform the task. 添加完电子邮件帐户后,尝试在模拟器中部署应用程序并执行任务。 You should able to see Email task right now. 您现在应该能够看到电子邮件任务。

Since there is no email account in the emulator, "It shows no apps to share, Can't share now". 由于模拟器中没有电子邮件帐户,“它显示没有要共享的应用程序,无法立即共享”。

On emulator, login with your Microsoft account and try again. 在模拟器上,使用您的Microsoft帐户登录,然后重试。 I solved this with login account. 我用登录帐户解决了这个问题。

You can test it on Device . 您可以在Device上测试它。 Because on your Emulator, there are not any mail account at all. 因为在您的模拟器上,根本没有任何邮件帐户。 So when you call ShowComposeNewEmailAsync method, it can't find any target. 因此,当您调用ShowComposeNewEmailAsync方法时,它找不到任何目标。 Or you can add account on your Emulator in Setting -> email+account. 或者您可以在设置 - >电子邮件+帐户中在模拟器上添加帐户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM