通过发送邮件获取收据通知

时间:2013-11-23 09:26:52

标签: c# email

这里我使用c#开发一个桌面应用程序来发送邮件。在那我想要添加邮件阅读通知。我使用下面的代码,但它不起作用。 - 非常感谢任何帮助。

我使用它但不起作用:

protected void btnSend_Click(object sender, EventArgs e)
{
    //txtFrom.Text = "test.common@gmail.com";
    try
    {
        MailMessage ms = new MailMessage();

        ms.To.Add(txtAddr.Text);
        ms.From = new MailAddress(txtFrom.Text);

        ms.Subject = txtSubject.Text;
        ms.Body = txtBody.Text;

         ms.DeliveryNotificationOptions =
                         DeliveryNotificationOptions.OnFailure |
                         DeliveryNotificationOptions.OnSuccess |
                         DeliveryNotificationOptions.Delay;
        ms.Headers.Add("Disposition-Notification-To", "<test.common@gmail.com>");

        //if (FileUpload1.HasFile)
        //{
        //    ms.Attachments.Add(new Attachment(
        //       FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
        //}

        SmtpClient smtp = new SmtpClient();

        smtp.Host = "smtp.gmail.com";
        //smtp.Host = "localhost";

        NetworkCredential cs = new NetworkCredential("test.common@gmail.com", "123");
        smtp.Credentials = cs;
        smtp.EnableSsl = true;
        smtp.Port = 587;

        smtp.Send(ms);

        Literal1.Text = "Your message has been sent...";
    }
    catch (Exception ex)
    {

        Literal1.Text = ex.Message;
    }

1 个答案:

答案 0 :(得分:0)

Gmail似乎不支持个人帐户的读取收据。

取自here

  

阅读回执仅适用于Google Apps for Business,教育和政府客户。它们不适用于个人Gmail帐户。立即升级。