Tuesday, 31 July 2012

How to send mails in asp.net









using System.Net;
using System.Net.Mail;
--------------------------------------
Copy below code in pageload:

try
    {
MailMessage mm = newMailMessage(TextBox1.Text, TextBox2.Text, TextBox3.Text,                                          TextBox4.Text);
      mm.IsBodyHtml = false;
NetworkCredential nc = newNetworkCredential("Your gamil id", "your gmail password");
SmtpClient sc = newSmtpClient("SMTP.gmail.com", 587);
      sc.EnableSsl = true;
       sc.UseDefaultCredentials = false;
       sc.Credentials = nc;
       sc.Send(mm);
      Label1.Text = "mail sended sucessfully";
   }
catch (Exception ex)
        {
            Response.Write(ex.Message);
        }


----------------------------------
Hints:
textbox1.text=fromaddress
textbox2.text=toaddress
textbox3.text=subject
textbox4.text=matter
              now u can understand why we placed textboxes and labels in design page.....
 to send mails provide your valied gmail id and gmail password
Enjoy the code....!

Monday, 17 October 2011

How to add gmap in asp.net

Code:
using System.Configuration;
using Subgurim;
using Subgurim.Controles;

-------------------------------------------------------
write this code in page load

{
        Subgurim.Controles.GLatLng gLatLng = new Subgurim.Controles.GLatLng(17.427231, 78.434578);//(17.427239, 78.43465);
        GMap1.setCenter(gLatLng, 16, GMapType.GTypes.MapMaker_Normal);
        GMap1.enableContinuousZoom = true;
        var omarker = new Subgurim.Controles.GMarker(gLatLng);
        GInfoWindow gmapinfo = new GInfoWindow(omarker, "<center><b>Sarayu Global Solutions</b><br>Plot No 590,Arora Colony,<br>Road No 3,Bangara Hills,HYD. </center>", true);
        GMap1.addInfoWindow(gmapinfo);
    }


----------------------------------------------------------------
Write this code in web.confg

<appSettings>
        <add key="GoogleMaps.Subgurim.net" value="ABQIAAAArKrLXt1alkjaZVnVCX8HCBSIhkdEuHkMXwkldojWLYSyEi8CBBTII70OuHyyc2uZtSvSJVQuvUTdAg"/>
        <add key="Chart Image Handler" value="Storage=file,Time Out=20"/>
        <add key="google"/>
    </appSettings>
---------------------------------------------------------------
                 enjoy the coding if u hd any doubts r if u like my post contact me....