0

如何在 Windows Phone 7 中设置或确认电子邮件帐户以从我的发送邮件应用程序发送电子邮件

我在 Windows Phone 7 中创建了简单的电子邮件发送应用程序,但是当我单击发送按钮时,我收到了这条消息:-" Make sure you've set-up an account and try again"

这是我的应用程序代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
namespace SendingMail
{
    public partial class MainPage : PhoneApplicationPage
    {
        EmailAddressChooserTask emailAddresstask;

        // Constructor
        public MainPage()
        {
            InitializeComponent();
            this.emailAddresstask = new EmailAddressChooserTask();
            this.emailAddresstask.Completed += new EventHandler<EmailResult>(emailAddresstask_Completed);
        }
        #region Events

        //Open Contact button click
        private void btnOpenContact_Click(object sender, RoutedEventArgs e)
        {
            emailAddresstask.Show();
        }

        //Email Address Chooser Task Completed
        private void emailAddresstask_Completed(object sender, EmailResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                txtTo.Text = e.Email;
            }
        }

        //Send mail button click
        private void btnMail_Click(object sender, RoutedEventArgs e)
        {
            EmailComposeTask Myemail_Composetask = new EmailComposeTask();
            Myemail_Composetask.To = txtTo.Text;
            Myemail_Composetask.Cc = txtCC.Text;
            Myemail_Composetask.Subject = txtSbj.Text;
            Myemail_Composetask.Body = txtbd.Text;
            Myemail_Composetask.Show();
        }
        #endregion
    }
}
4

1 回答 1

0

您不能在 Windows Phone 7 模拟器中设置电子邮件帐户。您需要在 Windows Phone 7 设备上对此进行测试,或者使用 Windows Phone 8 SDK 和 Windows Phone 8 模拟器为您的 Windows Phone 7 应用程序测试此方案。

从设备或 Windows Phone 8 模拟器,转到“设置”并选择“电子邮件+帐户”并添加帐户。

于 2012-12-03T18:23:11.913 回答