如何从Windows Phone 7应用程序发送电子邮件

时间:2014-03-24 11:11:59

标签: c# windows-phone

在我的Windows Phone 7应用程序中,我想发送一封电子邮件,其中邮件正文应包含上一页的数据。

private void Email_Send(object sender, RoutedEventArgs e)
{
EmailComposeTask emailComposeTask = new EmailComposeTask();

emailComposeTask.Subject = "message subject";
emailComposeTask.Body = "message body";
emailComposeTask.To = "recipient@example.com";
emailComposeTask.Cc = "cc@example.com";
emailComposeTask.Bcc = "bcc@example.com";
emailComposeTask.Show();
}

现在在正文部分我想要上一页的数据。那怎么做呢?

if (this.NavigationContext.QueryString.ContainsKey("school_name"))
{
//if it is available, get parameter value
school = NavigationContext.QueryString["school_name"];
school.Text = date;
}

请告诉我如何传递值

2 个答案:

答案 0 :(得分:1)

试试这个:

emailComposeTask.Body = + school;

答案 1 :(得分:1)

试试这个

private void Email_Send(object sender, RoutedEventArgs e)
{
string previousValue = string.empty;
if (NavigationContext.QueryString.ContainsKey("school_name"))
      previousValue = NavigationContext.QueryString["school_name"];
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = "message subject";
emailComposeTask.To = "recipient@example.com";
emailComposeTask.Cc = "cc@example.com";
emailComposeTask.Bcc = "bcc@example.com";
emailComposeTask.Body = previousValue ;
emailComposeTask.Show();
}