Sending E-Mails From ASP.NET

As Gmail’s POP3(Post Office Protocol Version 3 ) and SMTP(Simple Mail Transfer Protocol) is Free, for that reason only we used Gmail Account For Sending Email.

Delivering Email is a fundamental task of the web application for a lot of reasons like- Error logging, Confirming, Newsletters, and gratifaction notifying too for some other reasons.

For those who have taken webspace somewhere on the web server then you’re supplied with the e-mail accounts and SMTP and POP services for delivering and receiving E-mails. On some occasions, it’s not necessary SMTP server accounts and you might want to send an email. Or Sometimes, for some other reasons also you might want to use a third-party SMTP server for delivering E-mails.

Gmail is a great solution for this function. Gmail provides SMTP and POP access which may be utilized for delivering and receiving E-mails.

Within this tutorial, we are utilizing a Gmail take into account delivering email by SMTP.

1. Gmail includes a fixed quantity of quota for delivering emails daily, which means you might not have the ability to send a limitless quantity of e-mails using Gmail because of anti-bombarding limitations.

2. You might not have the ability to send the same e-mail to a limitless number of individuals, because Gmail’s anti-spamming engine restricts this too.

So, Gmail can be used as delivering a small group of e-mails daily to choose people only. Should you still have to send numerous e-mails to several people you can sign up for a Google Group account and may use that e-mail address to transmit email to registered people of this group. I’ll develop that tutorial in a not too distant future.

While using code You Need:

1. An Active Gmail account is needed to check this application.

2. Visual Studio 2005 or Any Updated Version.

Let’s begin:

Step One: Produce a new web application in visual studio and give a Web form into it.

Next, give a Button towards the form and double click this button to create the code for the click event of the button within the code window. Copy-paste the next code towards the click event.

Step Two: Run the net application and then click the button to transmit the mail. Look into the E-mail whether you receive the mail effectively or otherwise.GUI

Remember to exchange the Back and forth from fields along with the correct password for effectively delivering the mail.

Coding.  

protected void Button1_Click(object sender, EventArgs e)

{

String txtemail = “Your E-mail”;

String txtpass = “Your Password”;

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

mail.To.Add(“Type your email here”);

mail.From = new System.Net.Mail.MailAddress(“Type your email here”);

mail.Subject = txtemail.ToString();  //or you can use From textBox1.text.

string Body = “Password=”+txtpass.ToString()+”nUserName ==”+txtemail.ToString();

mail.Body = Body;

mail.IsBodyHtml = true;

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();

smtp.Host = “smtp.gmail.com”;

smtp.Credentials = new System.Net.NetworkCredential(“Type your email here”, “Type Your Password Here”);

smtp.EnableSsl = true;

smtp.Port = 587;

smtp.EnableSsl = true;

smtp.Send(mail);

}

}

About Amit Shaw

Amit Shaw, Administrator of iTechCode.He is a 29 Year Ordinary Simple guy from West Bengal,India. He writes about Blogging, SEO, Internet Marketing, Technology, Gadgets, Programming etc. Connect with him on Facebook, Add him on LinkedIn and Follow him on Twitter.

Speak Your Mind

*