protected void sendEmail()
{
using (MailMessage message = new MailMessage())
{
message.From = new MailAddress("from_address@gmail.com");
message.To.Add(new MailAddress("to_address@test.med.sa"));
//message.CC.Add(new MailAddress("copy@domain.com"));
message.Subject = "Special Medication Request from " + txtPhyName.Text.ToString() + " , " + txtPosTile.Text; //Subject Here
message.Body = "Drug Name : " + txtdrugName.Text.ToString() + "\n" + "Quantity: " + txtQtyReq.Text; //Body Of Email Content
SmtpClient client = new SmtpClient();
client.Host = "10.10.180.102";
client.Send(message);
}
}
Add this Name Space in C#:
using System.Net.Mail;
Call this method in Button or any kind of Form to send Email....
{
using (MailMessage message = new MailMessage())
{
message.From = new MailAddress("from_address@gmail.com");
message.To.Add(new MailAddress("to_address@test.med.sa"));
//message.CC.Add(new MailAddress("copy@domain.com"));
message.Subject = "Special Medication Request from " + txtPhyName.Text.ToString() + " , " + txtPosTile.Text; //Subject Here
message.Body = "Drug Name : " + txtdrugName.Text.ToString() + "\n" + "Quantity: " + txtQtyReq.Text; //Body Of Email Content
SmtpClient client = new SmtpClient();
client.Host = "10.10.180.102";
client.Send(message);
}
}
Add this Name Space in C#:
using System.Net.Mail;
Call this method in Button or any kind of Form to send Email....
0 comments:
Post a Comment