Gmail: IMAP, POP3, and SMTP settings

Gmail supports access via IMAP, POP3 and SMTP protocols. Below you can find the configuration settings for all protocols.

Remember that you must enable IMAP in Gmail or enable POP3 in Gmail first.

All Gmail servers (IMAP, POP3 and SMTP) use implicit SSL/TLS – use ConnectSSL method. SMTP additionally supports explicit SSL/TLS (you can use Connect method and then secure the channel using StartTLS .

IMAP

Server: imap.gmail.com
SSL: true-implicit
Port: 993 (default)
User: pat@gmail.com or pat@your-domain.com

POP3

Server: pop.gmail.com
SSL: true-implicit
Port: 995 (default)
User: pat@gmail.com or pat@your-domain.com

SMTP

Server: smtp.gmail.com
SSL: true-implicit / true-explicit
Port: 465 (default) / 587 (default)
User: pat@gmail.com or pat@your-domain.com

Following are the code samples for Mail.dll .NET IMAP, POP3 and SMTP component.

// C#

using (Imap client = new Imap())
{
    client.ConnectSSL("imap.gmail.com");
    client.UseBestLogin("pat@gmail.com", "password");
    ...
}

using (Pop3 client = new Pop3())
{
    client.ConnectSSL("pop.gmail.com");
    client.UseBestLogin("pat@gmail.com", "password");
    ...
}

using (Smtp client = new Smtp ())
{
    client.ConnectSSL("smtp.gmail.com");
    client.UseBestLogin("pat@gmail.com", "password");
    ...
}
' VB.NET

Using client As New Imap()
	client.ConnectSSL("imap.gmail.com")
	client.UseBestLogin("pat@gmail.com", "password")
	...
End Using

Using client As New Pop3()
	client.ConnectSSL("pop.gmail.com")		
	client.UseBestLogin("pat@gmail.com", "password")
	...
End Using

Using client As New Smtp()
	client.ConnectSSL("smtp.gmail.com")
	client.UseBestLogin("pat@gmail.com", "password")
	...
End Using

How to download emails from Gmail.

You can find more samples in each section:

Questions?

Consider using our Q&A forum for asking questions.