Quick Search

Sending Email with ASP.NET

February 27th, 2010 by admin
Leave a reply »

 

Asp.net provide a simple way to sending mail. You can implement mail code in you application following type.

 
using System.Web.Mail;
 
public partial class contact_us : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        sendmailfunc();
    }
    public void sendmailfunc()
    {
        string text = “”;
        text = text + “Hello ! this is a test mail

 
        System.Web.Mail.MailMessage objMail = new System.Web.Mail.MailMessage();
        objMail.To = “text@testmail.com”;
        objMail.Bcc = “dinesh2k20@gmail.com”;
        objMail.Subject = “Website Enquiry:”;
        objMail.Body = text;
        objMail.BodyFormat = MailFormat.Html;
        objMail.From = ” text@testmail.com “;
 
        try
        {
            SmtpMail.Send(objMail);          
        }
        catch
        {                    
        }
    }
}

“;

Posted in Email

You can follow any responses to this entry through the RSS 2.0 Feed. You can leave a response , or trackback from your own site.

Leave a Reply

SEO Company India

search engine marketing company India that offers affordable seo services