Rafeek
06-24-2007, 09:51 AM
hi all
i create web site (ASP.net 2.0 & C# 2005).
how can i send e-mail form my web site ?
thanx
Rafeek
i create web site (ASP.net 2.0 & C# 2005).
how can i send e-mail form my web site ?
thanx
Rafeek
|
Click to See Complete Forum and Search --> : send mail Rafeek 06-24-2007, 09:51 AM hi all i create web site (ASP.net 2.0 & C# 2005). how can i send e-mail form my web site ? thanx Rafeek Phil Weber 06-24-2007, 09:58 AM http://forums.devx.com/showthread.php?t=161556 Bharati 06-29-2007, 05:35 AM Hi, In ASP.Net application, we can send mails bt using either the smtpMail class or the MailMessage class. Both these classes are designed to work with the Microsoft SMTP service, which is used for sending electronic mails. Both these classes are found in the System.Web.Mail namespace. Therefore, to use either of these classes you need to include the System.Web.Mail namespace. The below code is for sending email using MailMessage class from ASP.Net page. To use the MailMessage class, we first need to create an instance of the class by using the following syntax. MailMessage oMessage = new MailMessage(); Here, oMessage represents an object of the mailMessage class. String strHTMLBody; strHTMLBody = "<html><head><title>Registration.</title></head><body>Congratulations ! You have successfully completed registration.</body></html> "; MailMessage oMessage = new MailMessage(); oMessage.Subject = "Confirm your registration. JobsKen"; oMessage.Body = strHTMLBody; oMessage.IsBodyHtml = true; oMessage.From = new MailAddress("kk@jobsken.com"); oMessage.To.Add(new MailAddress(txtEmail.Text)); oMessage.Priority = MailPriority.High; sends a specified MailMessage instance to a specified SMTP server. SmtpClient client = new SmtpClient("smtp.XXXX.com"); //smtp.XXXX.com is the SMTP server client.UseDefaultCredentials = true; client.Send(oMessage); //Send the MailMessage via the SmtpClient object's Send method. Database programming using Visual basic 2005 and Csharp 2005 (http://www.vkinfotek.com) devx.com
Copyright Internet.com Inc. All Rights Reserved |