Hiiiiii.
i have some problem for sending mail in .net. I don't know how can i do plz give me solution
How to send mail in .net window application with c# languge?
Loading
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.
Abhineet SrivastavaPosted Aug 24, 2013, 9:42 AM
http://www.c-sharpcorner.com/UploadFile/9f0ae2/Asp-Net-sending-emails/
Cheers
Abhineet SrivastavaPosted Aug 24, 2013, 8:31 AM
{
MailMessage message = new MailMessage(mailfrom, mailto, mailsubject, mailmessage);
message.IsBodyHtml = true;
SmtpClient emailClient = new SmtpClient(ConfigurationManager.AppSettings["SmtpIpAddress"]);
try
{
emailClient.Send(message);
}
catch (Exception err)
{ }
}
sahil kumarPosted Aug 24, 2013, 8:12 AM
string strSubject = "TYPE YOUR SUBJECT LINE HERE";
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
NetworkCredential oCredential = new NetworkCredential("GmailUSERID", "GMAILPASSWORD");
client.UseDefaultCredentials = false;
client.Credentials = oCredential;
MailAddress sendfrom = new MailAddress("GmailUSERID ", "");
MailMessage message = new MailMessage();
message.To.Add("EMAIL ID WHOM TO SEND MAIL");
message.CC.Add(EMAIL ID WHOM TO SEND MAIL CC);
string strMail="hello how are you!";
message.From = sendfrom;
message.IsBodyHtml = true;
message.Subject = strSubject;
message.Body = strMail;
client.Send(message);