usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Net;usingSystem.Net.Mail;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;namespaceemail_sending{publicpartialclassemail:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidsend_Click(objectsender,EventArgse){try{MailMessagemessage=newMailMessage();SmtpClientsmpt=newSmtpClient();message.From=newMailAddress("Enter Your Email Here");message.To.Add(newMailAddress(to.Text));message.Subject="Testing";message.IsBodyHtml=true;message.Body=body.Text;smpt.Port=587;smpt.Host="smtp.office365.com";smpt.EnableSsl=true;smpt.UseDefaultCredentials=false;smpt.Credentials=newNetworkCredential("Enter Your Email Here","Enter Your Passwrod");smpt.DeliveryMethod=SmtpDeliveryMethod.Network;smpt.Send(message);}catch(Exceptionex){}}}}
Top comments (0)