0
Answer

how to track bounced emails in asp.net

nikul bhuva

nikul bhuva

10y
596
1

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