Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My Emails are successfully sent but it is not showing in sent item.

What I have tried:

MailMessage mail = new MailMessage();
mail.To.Add("email");
mail.From = new MailAddress("email");
mail.Subject = "Test";
mail.Body = "Test";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("smtp.****.**.in", 25);
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("email", "**");
smtp.Timeout = 1200000;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
smtp.Send(mail);
Posted
Updated 26-Jun-20 0:49am
Comments
Garth J Lancaster 26-Jun-20 2:14am    
you might want to update your question (use "Improve question") and let us know what SMTP Server you're using eg Exchange 2013, GMail, ...
Member 14512875 26-Jun-20 2:18am    
Actually I cant show the smtp server name.
Garth J Lancaster 26-Jun-20 2:46am    
no, I meant the type of SMTP Server - I dont care about the 'name' of it .. 'what' is it
Richard MacCutchan 26-Jun-20 3:47am    
That is correct. SmtpClient only sends the message to the server you specify. Saving the message in a local folder is your responsibility.

I stand corrected.
Member 14512875 26-Jun-20 4:16am    
I am not trying to save on local folder.Like in gmail if sent a mail to any person it automatically saved in sent item but in my case it's not happening.By the way I am not using gmail.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900