i want to send mail programatically with my website and i cant do this. this is my code
MailMessage sendMailMessage = new MailMessage();
sendMailMessage.From = new MailAddress("info@myemail.ir", "");//esb@ertebatsanatbazar.ir
sendMailMessage.To.Add(txtemail.Text);
sendMailMessage.Bcc.Add(txtemail.Text);
sendMailMessage.Subject = "وبسایت تبلیغاتی";
string mailBody = "کاربر گرامی سلام؛ از اینکه وبسایت ما را برای تبلیغات خود انتخاب کردید متشکریم کد فعالسازی حساب کاربری شما:" + vercode.ToString();
sendMailMessage.Body = mailBody;
sendMailMessage.IsBodyHtml = true;
NetworkCredential netCredential = new NetworkCredential("info@myemail.ir", "****");
SmtpClient smtpClient = new SmtpClient("info@myemail.ir", 25);
smtpClient.EnableSsl = true;
smtpClient.Credentials = netCredential;
smtpClient.Send(sendMailMessage);
and get following error:
The remote name could not be resolved: 'info@myemail.ir
finally it work with this:
SmtpClient smtpClient = new SmtpClient("myserver.com", 25);
thank you pasilda