send mail directly using button
how to send mail directly on button click
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh KumarPosted Mar 22, 2019, 10:34 AM
Md SarfarajPosted Mar 22, 2019, 10:19 AM
Rajeesh MenothPosted Mar 19, 2019, 12:15 AM
Siddhartha SharmaPosted Mar 18, 2019, 11:40 PM
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress("FromMailAddress");
message.To.Add(new MailAddress("ToMailAddress"));
message.Subject = "Test";
message.IsBodyHtml = true; //to make message body as html
message.Body = htmlString;
smtp.Port = 587;
smtp.Host = "smtp.gmail.com"; //for gmail host
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("FromMailAddress", "password");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message); // Mail sent
use above methodSalman BegPosted Feb 26, 2019, 8:41 AM
Sanwar RanwaPosted Feb 26, 2019, 2:36 AM