ASP.Net Sent Email
{
using (System.Net.Mail.MailMessage message = new MailMessage())
{
message.To.Add(new MailAddress("To Email adddress"));
message.CC.Add(new MailAddress("CC Email adddress"));
message.Subject = " < Your Subject >"
message.Body =" < Message>"
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com"; //gmail
client.Port = 587;
client.Credentials = new System.Net.NetworkCredential("Sender Email", "Password");
client.EnableSsl = true;
client.Send(message);
}
Messagebox.show("Email sent Suessfully");
}
catch (Exception e)
{
Messagebox.show(e.message);
}
Solutions 1:
try{
using (System.Net.Mail.MailMessage message = new MailMessage())
{
message.To.Add(new MailAddress("To Email adddress"));
message.CC.Add(new MailAddress("CC Email adddress"));
message.Subject = " < Your Subject >"
message.Body =" < Message>"
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com"; //gmail
client.Port = 587;
client.Credentials = new System.Net.NetworkCredential("Sender Email", "Password");
client.EnableSsl = true;
client.Send(message);
}
Messagebox.show("Email sent Suessfully");
}
catch (Exception e)
{
Messagebox.show(e.message);
}
No comments:
Post a Comment