Monday, 27 December 2010

SMTP/POP3 Settings for GMAIL, HOTMAIL, YAHOO, AOL, AIM

Gmail:
Incoming Mail server (POP3): pop.gmail.com
Port Number: 995
Outgoing Mail server (SMTP): smtp.gmail.com
Port number: 995
The Google Gmail SMTP Server requires an encrypted connection (SSL) on port 465.

HOTMAIL:
Incoming Mail server (POP3): pop3.live.com
Port Number: 995
Outgoing Mail server (SMTP): smtp.live.com
Port number: 25
The HOTMAIL SMTP Server requires an encrypted connection (SSL) on port 995 and even on 25.

YAHOO!!:
Incoming Mail server (POP3): Required Yahoo!! Plus account
Port Number: Required Yahoo!! Plus account
Outgoing Mail server (SMTP): smtp.mail.yahoo.com
Port number: 587

AOL/AIM:
Incoming Mail server (POP3): imap.aol.com
Port Number: 143
Outgoing Mail server (SMTP): smtp.aol.com
Port number: 587

Sample code OUTGOING:
SmtpClient sC = new SmtpClient("smtp.gmail.com");
sC.Port = 587;
sC.Credentials = new NetworkCredential(“USERNAME”,”PASSWORD”);
sC.EnableSsl = true;
sC.Send(mM);

Sample code INCOMING:
Pop3 pop3 = new Pop3()
pop3.ConnectSSL("pop3.live.com", 995);
pop3.Login("USERNAME", "PASSWORD");
List<string> uids = pop3.GetAll();
for (int i = totalMesg - 1; i >= 1; i--)
{
IMail email = new MailBuilder().CreateFromEml(pop3.GetMessageByUID(uids[i]));
Console.WriteLine(email.TextData.ToString());
Console.WriteLine(email.Subject);
Console.WriteLine(email.Sender.ToString());
Console.WriteLine(email.Date.ToString());

}
pop3.Close();

Feel Free to Ping me for any kind of help and support!! Thanks!!
~jawed