MailMessage msg = new MailMessage(); msg.From = new MailAddress("demoejk@gmail.com"); msg.To.Add("demoejk@gmail.com"); msg.Subject = "Sucessfull Regesiration to F2"; msg.IsBodyHtml = true; msg.Body = "Congrats " + TextBox1.Text + " u have been sucessfully registred to F2 Keep visiting regularly "; SmtpClient client = new SmtpClient("Smtp.gmail.com", 587); client.Credentials = new NetworkCredential("demrike", "XXXXXXXX"); client.EnableSsl = true; try { client.Send(msg); Response.Write("mes has been sent"); } catch (Exception er) { Response.Write(er.Message); Response.Write(er.Source.ToString()); > }
<system.net> <defaultproxy> <proxy proxyaddress="ip address of proxy server" /> </defaultproxy> </system.net>
MailMessage oMsg = new MailMessage(); oMsg.From = new MailAddress("xxx@gmail.com", "xxx"); oMsg.To.Add(new MailAddress("yyy@gmail.com", "xxx")); oMsg.Subject = "Packet Parsing Problem"; oMsg.Body = " Problem Occuread test mail"; oMsg.SubjectEncoding = System.Text.Encoding.UTF8; oMsg.BodyEncoding = System.Text.Encoding.UTF8; oMsg.IsBodyHtml = false; oMsg.Priority = MailPriority.High; SmtpClient oSmtp = new SmtpClient("smtp.gmail.com", 587); oSmtp.DeliveryMethod = SmtpDeliveryMethod.Network; oSmtp.EnableSsl = true; NetworkCredential oCredential = new NetworkCredential("xxx@gmail.com", "123456aA"); oSmtp.UseDefaultCredentials = false; oSmtp.Credentials = oCredential; oSmtp.Send(oMsg);
MailAddress mailfrom = new MailAddress ( "frommail@gmail.com" ); MailAddress mailto = new MailAddress ( "tomail@gmail.com" ); MailMessage newmsg = new MailMessage ( mailfrom, mailto ); newmsg.Subject = "Subject of Email"; newmsg.Body = "Body(message) of email"; ////For File Attachment, more file can also be attached //Attachment att = new Attachment ( "G:\\code.txt" ); //newmsg.Attachments.Add ( att ); SmtpClient smtps = new SmtpClient ( "smtp.gmail.com", 587 ); smtps.UseDefaultCredentials = false; smtps.Credentials = new NetworkCredential ( "mail@gmail.com", "pwd" ); smtps.EnableSsl = true; smtps.Send ( newmsg );
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)