简体   繁体   中英

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. 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. I solved this with login account.

You can test it on 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. Or you can add account on your Emulator in Setting -> email+account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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