问题
I'm attempting to send a set of emails in a App store app using
var mail = new Uri("mailto:test@somedomain.com");
await Windows.System.Launcher.LaunchUriAsync(mail);
the email client starts but only the last email is displayed. I really need to "queue" the emails to the client. Is this possible?
It has been suggested to use a share contract, but I assume I may have to prompt the user to share each email?
Note: I'm sending multiple emails to multiple recepients, not email to multiple recepients.
回答1:
If you want to send a batch of emails from a Windows Store app, the best idea would be to create a web service for that purpose and call it from your app with all the data you need to create these emails.
You could send emails directly from your users device in several ways, but all of them have disadvantages unless these are one off emails that the user would want to send interactively:
The suggested way is using a share contract, but in this case the user will have to select the recipient himself and you will have no information whether he actually sent the email or not. Even more than that: the user could select a different share target and e.g. post a tweet instead of send an email. You have no control.
You could launch a
mailto
uri as you attempted but this strongly depends on the default application the user has selected for this protocol. It might open the mail client, it might open a browser or it might not work at all. And of course you still don't know whether the user will actually send the emails. Again, you have no control.The third option would be to send the email programatically directly from your app without user intervention. There is no API for that available on purpose. Even if you implement the protocol yourself, you'll still need the user to set up the SMTP settings. This is also strongly discouraged and it might prevent your app from passing the certification.
来源:https://stackoverflow.com/questions/14354142/winrt-bulk-send-email