I tried to send email from c# using SmtpClient.Send() but it always goes to the junk box. It works fine if I send it from Outlook. Is there anyway to solve this? Someone told me to modify the email header but I don't know how. Thanks in advance. Here is my code
SmtpClient client = new SmtpClient();
client.Host = "smtp.server.com";
client.Credentials = new System.Net.NetworkCredential("user", "password");
MailAddress mailFrom = new MailAddress("[email protected]");
MailAddress mailTo = new MailAddress("[email protected]");
MailAddress mailReply = new MailAddress("[email protected]");
MailMessage message = new MailMessage(mailFrom, mailTo);
message.Body = "This is a test message.";
message.Subject = "test message";
message.SubjectEncoding = System.Text.Encoding.UTF8;
message.BodyEncoding = System.Text.Encoding.UTF8;
client.Send(message);