nikul bhuva

nikul bhuva

  • NA
  • 8
  • 3.2k

how to track bounced emails in asp.net

May 2 2014 7:04 AM

var myMailMessage = new System.Net.Mail.MailMessage();
        myMailMessage.From = new System.Net.Mail.MailAddress("[email protected]");
        myMailMessage.To.Add("[email protected]");// Mail would be sent to this address
        myMailMessage.Subject = "Feedback Form";
        myMailMessage.Body = "Hello";

        MailAddress adminAddress = new MailAddress("[email protected]");
        //Add "Disposition-Notification-To" for Read receipt
        myMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;
        myMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
        myMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.Delay;
        myMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.Never;
        myMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.None;

        myMailMessage.ReplyToList.Add("[email protected]");
        myMailMessage.Headers.Add("Return-Receipt-To", "\"Track Software\" <[email protected]>");

        var smtpServer = new System.Net.Mail.SmtpClient("smtp.gmail.com");
        smtpServer.Port = 587;
        smtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "@@@@@@@@@@@@");
        smtpServer.EnableSsl = true;
        smtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
        myMailMessage.Priority = System.Net.Mail.MailPriority.High;
        try
        {

            smtpServer.Send(myMailMessage);
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.ToString();
        }

this is my code can you give where am doing Mistake i cant get failure mail on [email protected] can give me reply plz help me thank you