Problem on Sending Mail on Live
Hi Developers ,I have a mail function in my code mail is sends Successfully on Localhost.
But the same code does not working Exactly on live(when host to our server).
Mails sends only for Gmail account(paulcse@gmail.com).
Does not send yahoo, etc(rosepaulcse13@yahoo.com).
My Code is below,
public void EmailSend(string frmID, string frmName, string toID, string subMsg, String BodyMsg, bool status)
{
try
{
SmtpClient smtpclient = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("labmateasia16@gmail.com", "labmateasia16@gmail.com");
smtpclient.Host = "smtp.gmail.com";
smtpclient.Port = 587;
message.From = fromAddress;
message.To.Add(toID);
message.Subject = subMsg;
message.Body = BodyMsg;
message.BodyEncoding = System.Text.Encoding.ASCII;
message.IsBodyHtml = status;
message.Priority = MailPriority.High;
NetworkCredential ocredential = new NetworkCredential("donotreply00@gmail.com", "12345");
smtpclient.EnableSsl=true;
smtpclient.UseDefaultCredentials = false;
smtpclient.Credentials = ocredential;
smtpclient.Send(message);
}
catch { }
}
in Live i have changed below lines
smtpclient.EnableSsl=false ;
smtpclient.UseDefaultCredentials =true ;
Any possible to rectify this error. help me friends
Thanking you
Paul.S