0
votes
public void SendMAil()
{
    MailMessage newMail = new MailMessage();
    newMail.To.Add("[email protected]");
    newMail.From = new MailAddress(ConfigurationManager.AppSettings["FromMail"].ToString(), ConfigurationManager.AppSettings["FromMailDisplayName"].ToString());
    newMail.Subject = "Hi";
    newMail.Body = "this is the body";
    SmtpClient SurveyMailClient = new SmtpClient(ConfigurationManager.AppSettings["SEMailServerIP"].ToString(), Convert.ToInt32(ConfigurationManager.AppSettings["SEMailServerPortNumber"]));
    SurveyMailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
    SurveyMailClient.UseDefaultCredentials = true;
    SurveyMailClient.Send(newMail);
}

Using the above code I am not able to track the undelivered mails in my outlook mail box(From Adress).If the mail is delivered successfully,the sent mail is not saving in Sent Items folder and if a mail is undelivered, mail delivery failure notice is not coming to my Inbox. So please help me how to track the undelivered mails from my application side using the above code.

1
You should provide more details, and a question. Why isn't Outlook tracking your mails? How do you know? I've got a feeling Outlook doesn't even show the mails you've sent, but that's just my guess. Please, more details, we only know what you tell us.Onkelborg
Ok, now we got something similar to a real problem. Are you using the same "From" mail address as your account in Outlook?Onkelborg
by using SmptClient you're 'bypassing' Outlook, they are not related. You need to use office interop and make Outlook actually send the message to get the items stored in your sent folder.Ventsyslav Raikov
Note: Office Interop is only useful in a desktop application, not a service (web application for example.)Onkelborg
I have configured my outlook with a valid mail ID.From asp.net application: From that mail Id, using SMTPClient objcet i am sending the mail.The mail is delivering successfully.But it is not showing in Sentitems.If suppose mail is not delivered i am not getting mail failure notice in my mail box.Please tell me how to track the falied mail messages.Harikasai

1 Answers

0
votes

SMTP will only deliver the message, you have to manually "send" a copy into the "Sent Items" folder somehow. My best bet would be using IMAP.