protected void btnSend_Click(object sender, EventArgs e)
{
string mFrom = "xxx.com";
string mTo = "yyy.com";
string msub="TESTSUBJECT";
string mMsg="TEST msg";
string mCc = "Test cc";
// User credential used for sending mail
string EmailSender = "xxx.com";
string EmailSenderPasswd = "zzz";
System.Net.NetworkCredential myCachet = new System.Net.NetworkCredential(EmailSender, EmailSenderPasswd);
SmtpClient smtp = new SmtpClient("smtpout.secureserver.net", 12234);
smtp.Credentials = myCachet;
MailMessage message = new MailMessage(mFrom.ToString(), mTo.ToString());
message.Subject = msub.ToString();
message.Body = mMsg.ToString();
message.IsBodyHtml = true;
if (mCc.Trim() != String.Empty)
{
message.CC.Add(new MailAddress(mCc.ToString()));
}
smtp.Send(message);
message.Dispose();
}
If i pass the wrong password, smtp.send(message) method returns "Message failure". But if im pass wrong email address it returns as success message as "Message Success" and it does not deliver any exception even i tried try and catch exception. How to know that message is delivered successfully? If that message is not delivered successfully means it should throws a undelivered message like gmail(Message delivery failed). Help me.
On Adding:
Delivery Notification Mail works. But i have to store undelivered mail details in db. How to track that undelivered mails(By Username).