Gmail, the world most popular email service developed by Google. Today just about almost everyone owns a Gmail account. We know it is pretty easy to create a VBA script in Microsoft Excel to integrate with Microsoft Outlook, from there, we can send an Outlook email, create an Outlook task and contacts, all within Excel. But do you know that, in VBA (Excel, Access, Outlook, Word, PowerPoint), we can also write a script to send an email from our Gmail account or any email service provider uses SMTP, IMAP, POP server settings.

In this tutorial, I will walk you through how to write a VBA script to send an email from your Gmail account.

Important: Makes sure you activate Microsoft CDO for Windows 2000 library first.

Email Provider IMAP Settings POP Settings SMTP Settings
Gmail

Server: imap.gmail.com

Port: 993

Encryption: SSL/TLS

Server: pop.gmail.com

Port: 995

Encryption: SSL/TLS

 

Server: smtp.gmail.com

Port: 465

Encryption: SSL/TLS

 

Outlook.com

 

 

Server:
imap-mail.outlook.com

Port: 993

Encryption: SSL/TLS

 

 

Server:
pop-mail.outlook.com

Port: 995

Encryption: SSL/TLS

Server:
smtp-mail.outlook.com

Port: 587

Encryption: STARTTLS

Office 365

 

 

Server: outlook.office365.com

Port: 993

Encryption: SSL/TLS

 

 

Server: outlook.office365.com

Port: 995

Encryption: SSL/TLS

 

Server: smtp.office365.com

Port: 587

Encryption: SSL/TLS

iCloud

Server: imap.mail.me.com

Port: 993

Encryption: SSL/TLS

 

Not available

 

 

Server: smtp.mail.me.com

Port: 587

Encryption: STARTTLS

 

 

VBA Script