Tuesday, November 17, 2009

send mail from asp.net to gmail

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;

// Now open your .aspx page replace the page_load with below code

protected void Page_Load(object sender, EventArgs e)
{
MailMessage message = new MailMessage();

try
{
MailAddress fromAddress = new MailAddress("pallelokanathareddy@gmail.com", "Lokanatha");
message.From = fromAddress;
message.To.Add("pallelokanathareddy@gmail.com");
message.Subject = "Feedback";
message.IsBodyHtml = false;
message.Body = "Hello Lokanatha";
sendmails(message);
Label1.Text = "Email successfully sent.";
}
catch (Exception ex)
{
Label1.Text = "Send Email Failed." + ex.Message;
}
}

public void sendmails(MailMessage mm)
{
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "pallelokanathareddy@gmail.com";
NetworkCred.Password = "youe actual gmail password for the mail id mentionaed in the above code"; ;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);

}


Smtp settings:

note: smtp server should be installed in your computer.your system must have internet connection
1.go to start>run
2.type "inetmgr" in the run press ok
3.in the newly opened internet service manager navigate to "default smtp virtual server"
4.go to domain right click new>domain
5.select remote and click next"smtp.gmail.com" and click finish.
6.now go to "default smtp virtual server" right click choose "Properties" and click.
7.in the ip address dropdown choose your system ip.
8.go to "access" tab click on "Relay"
9.selectradio buton "only the list below" and also check "allow all the computers which success fully authenticate to relay.regardless of the list above" click ok.
10.in the connection select "only the list below" click ok.
11.click on "Authentication" button choose "Anonymous Acess" click ok.
12.close your iis window.


Now run the code it sends email to the to address.

Friday, July 3, 2009

Dotnet Training trivandrum

Training classes on .net 2.0 and 3.0 near to techno park+trivandrum.cotact us at pallebusiness@gmail.com
Course contents
c#:
1.Object oriented Programming(classes,structs,memory allocation,objects,class types etc..)
2.Dotnet Framework(2.0,3.0,3.5)
2.a.assemblies
2.b.msil,pe files,clr,cts,cls,dlr etc..
2.c.new frame work concepts like nullable types,anonymous methods,generics etc..
3.Garbage Collection & memory internals indepth
4.Insights of C#
a. Types
b. Variables
c. Conversions
d. Expressions
e. Statements
f. Namespaces
g. Classes
h. Structs
i. Arrays
j. Interfaces
k. Enums
l. Delegates
m. Exceptions
n. Attributes

5.Intro to design Patterns(Singleton,Factory,Abstract Factory,Observer,stategy,facade etc..)