I am trying to send mail from gmail and it's sent successfully in localhost but when publish website on server didn't send
JAY SINGH YADAV
1
Reputation point
My Code Running fine on Local Host.
mail.From = new MailAddress("xyz@Stuff .com");
mail.To.Add(ObjBE.Email1);
mail.Subject = Subject;
//mail.Priority = MailPriority.High;
mail.Body = body;
mail.IsBodyHtml = true;
using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25))//For Local use 587 Port
{
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("xyz@gmail.com", "*********"); // **** is gmail Secure Password.
smtp.EnableSsl = true;
smtp.Send(mail);
}
Sign in to answer