Enable IMAP in Gmail

  1. Sign in to Gmail.
  2. Click the gear icon in the upper-right and select Settings.
  3. Click Forwarding and POP/IMAP.
  4. Select Enable IMAP.
  5. Remember that Gmail only allows secure SSL connections so you need to use ConnectSSL method.

Perfectly secure ‘less’ secure apps

For some (newer) Google accounts you may need to enable access for ‘less’ secure apps (for Google Apps this setting is not available – it’s enabled by default).

Please note that contrary to what the label says those applications (such as Thunderbird or Outlook) are secure – they use TLS or SSL to secure the communication.

The term ‘less secure apps’ is used only because such applications need to be provided with account’s primary password to be able to access IMAP.

‘Less’ secure apps alternatives

  1. OAuth 2.0 (OAuth 2.0 for installed applications, OAuth 2.0 for web applications, OAuth 2.0 for service accounts) which works despite the disabled ‘less secure apps’ setting.
  2. Application specific passwords (2-Step-Verification must be enabled to access this feature: Create application specific password)

2-step verification

If you use 2-Step-Verification and are seeing a “password incorrect” error when trying to access IMAP, an app password may solve the problem. An application specific password is a 16-digit password that gives an application permission to access your Google Account.

2-Step-Verification must be enabled to access this feature:
Create application specific password.

Simple .NET IMAP access sample

// C# code:

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


	List<long> uids = imap.Search(Flag.Unseen);
	foreach (long uid in uids)
		var eml = imap.GetMessageByUID(uid);
		IMail mail = new MailBuilder().CreateFromEml(eml);

' VB.NET code:

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


	Dim uids As List(Of Long) = imap.Search(Flag.Unseen)
	For Each uid As Long In uids
		Dim eml = imap.GetMessageByUID(uid)
		Dim mail As IMail = New MailBuilder().CreateFromEml(eml)

End Using

More .NET IMAP samples. You can download Mail.dll IMAP library for .NET here.

Tags: ,

2 Responses to “Enable IMAP in Gmail”

  1. Download unseen emails from Gmail Says:

    […] First remember to enable IMAP in Gmail. […]

  2. Archive email in Gmail Says:

    […] First remember to enable IMAP in Gmail. […]


Consider using our Q&A forum for asking any questions.