Sending mail Asp.Net

using System.Net.Mail;

Create Event :

Button_click()
{
string EmailIDD =”suba@gmail.com
string from = “ram@gmail.com“;
SmtpClient mailClient = new SmtpClient();
string Sub = “Mail Sending”;
string body = “Description of Mail Sending”;
mailClient.Send(from, EmailIDD, Sub, body);

}

Go to Web Configuration File:

<Configuration>
<system.net>
<mailSettings>
<smtp from=”ram@gmail.com“>
<network host=”mail.gmail.com” password=”xxxxx” userName=”ram@gmail.com“/>
</smtp>
</mailSettings>
</system.net>
</Configuration>

smtp from == > valid email id & password :
here from address should me same………..

Advertisements

Leave a Reply

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

%d bloggers like this: