Sending mail through ASP.NET

In this topic, I want to give a tutorial: How to send mail with the help of ASP.NET. Through these codes, you can make your own mail transfer system. Actually you are building a mediator, which helps another account and password to forward your mail to given id. Before writing this code, please get your port id. Like for Google/ Gmail its 587. Here I am gonna use my gmail account. Lets see.

First make a page. Say contact.aspx.

contact.png

Make a button, ay Submit. And on click, write these codes. And add these library to your cs file. So lets create contact.aspx.cs page.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Mail;
contact.aspx.cs

In place of “mypassword” give your password for the mail id you are using to send (I used deepeshsingh09@yahoo.com). Any query, drop a comment.

Signature

Deepesh Singh
logo

Advertisements

Please leave your valuable comment.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s