Thursday, June 21, 2007

Send an email by GMail from ASP.NET 2.0

If you try to use ChangePassword control with GMail server in your settings, you'll probably get failed. To fix that you need to use SSL to send an email, and also - set SMTP server port to 587.

To use SSL add a handler to SendingMail event of the control with the following body:

protected void _ctrlPasswordRecovery_SendingMail(object sender, MailMessageEventArgs e)

{

        // send the same email, but with SSL enable

    SmtpClient client = new SmtpClient();

    client.EnableSsl = true;

    client.Send(e.Message);

 

        // cancel the sending by control

    e.Cancel = true;

}

Labels: , , , , ,

2 Comments:

Anonymous Anonymous said...

can we do event handling using this library.

I added NGChart library into my application and able to generate different kind of charts by getting data from database.
But i need to develop dasboard which i can be accessed individual bargraph parts by clicking .

4:41 PM  
Blogger digizzle said...

The library just generates URLs for images.

It will be easier to put the image in a control (say, ImageButton), which handles clicks.

7:05 PM  

Post a Comment

<< Home