简体   繁体   English

从Windows Phone 7设备静默发送电子邮件?

[英]Silently sending an email from a Windows Phone 7 device?

Is it possible to silently send an email from a Windows Phone 7 device? 是否可以从Windows Phone 7设备静默发送电子邮件?

The reason I ask is because 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. 只要您在服务器上运行SMTP服务器,就可以发送电子邮件。

Web services are designed for this sort of thing, email isn't. Web服务是为这种事情而设计的,而电子邮件不是。 You won't find emails simpler. 您不会发现电子邮件更简单。 Look into WCF. 查看WCF。

Of course you can, sending email can be achieved with the EmailComposeTask . 当然可以,使用EmailComposeTask可以发送电子邮件。 To use the EmailComposeTask , you must include the namespace Microsoft.Phone.Tasks . 要使用EmailComposeTask,必须包含名称空间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 . 可以在Microsoft.Phone.dll中找到此命名空间。要发送电子邮件,请创建EmailComposeTask的实例,并设置适当的属性,例如“收件人”,“主题”和“电子邮件正文”。

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 调用Show方法时,将打开EmailComposer,使用户可以单击“发送”按钮来发送电子邮件

I hope it's clear :) 我希望很清楚:)

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

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