I am unable to send the mail using smtp client.
here is the code:
SmtpClient client=new SmtpClient("Host");
client.Credentials=new NetworkCredential("username", "password");
MailMessage mailMessage = new MailMessage();
mailMessage.from="
[email protected]";
mailMessage.To.Add("
[email protected]");
mailMessage.body="body";
mailMessage.subject="subject";
client.Send(mailMessage);
The problem is that when I use this code in ASP.
NET application, I do not recieve any mails. When in asp.
net I change the from mail address to username given in NetworkCredential, I recieve mails.
But in C# windows application, I can get emails, even if sender's email address is not valid.
Thanks in advance....