开发者

Silently sending an email from a Windows Phone 7 device?

开发者 https://www.devze.com 2023-03-14 00:49 出处:网络
Is it possible to silently send an email from a Windows Phone 7 device? The reason I ask is becau开发者_StackOverflowse I would like to have a system from which an app will send information to a serv

Is it possible to silently send an email from a Windows Phone 7 device?

The reason I ask is becau开发者_StackOverflowse I would like to have a system from which an app will send information to a server which the server will log. I figure if I use emails it would be a lot more straightforward than some other system.

As you can probably guess from my question I'm in completely unexplored territory here.


It's possible to send emails, so long as you are running the SMTP server on your server.

Web services are designed for this sort of thing, email isn't. You won't find emails simpler. Look into WCF.


Of course you can, sending email can be achieved with the EmailComposeTask. To use the EmailComposeTask , you must include the namespace Microsoft.Phone.Tasks .

*`Using Microsoft.Phone.Tasks ;`*

This namespace can be found in the Microsoft.Phone.dll To send the email , create an instance of the EmailComposeTask and set the appropriate properties like To , Subject and Body of the Email .

private void button1_Click(object sender, RoutedEventArgs e)
{
    EmailComposeTask emailcomposer = new EmailComposeTask();
    emailcomposer.To = "<a href="mailto:test@ginktage.com">test@ginktage.com</a>";
    emailcomposer.Subject = "subject from test app";
    emailcomposer.Body = "This is a test mail from Email Composer";
    emailcomposer.Show();
}

When the Show method is called , the EmailComposer is opened which lets the user to click the send button to send the email

I hope it's clear :)

0

精彩评论

暂无评论...
验证码 换一张
取 消