Skip to main content

SMTP Settings for Outlook365 and Gmail

What are the SMTP settings for Office 365?
What is the mail server for Outlook?
To send emails we will need to configure the SMTP settings-

Office365 with SSL -
SMTP Server: This should be your mail server name. (e.g. smtp.office365.com)
SMTP Security: Enable SSL
Port: 995

Office365 with TLS -
SMTP Server: This should be your mail server name. (E.g., smtp.office365.com)
SMTP Security: Enable TLS
Port: 587

Gmail -
SMTP Server: smtp.gmail.com
Port: If SSL is enabled use Port 465. If TLS is enabled use Port 587.
Auth Username: This will be your full Gmail address. (e.g. anil.singh581@gmail.com)

IMAP Server Settings

The following are the incoming and outgoing IMAP server settings for Office 365.
SettingIMAP (incoming)SMTP (outgoing)
Server Nameoutlook.office365.comsmtp.office365.com
Port Number993587
Encryption MethodSSLTLS

Example - C# code looks like

// C#
using (Imap client = new Imap())
{
    client.ConnectSSL("outlook.office365.com");
    client.UseBestLogin("admin@your-domain.com", "your-password");
    ...
}

using (Pop3 client = new Pop3())
{
    client.ConnectSSL("outlook.office365.com");
    client.UseBestLogin("admin@your-domain.com", "your-password");
    ...
}

using (Smtp client = new Smtp ())
{
    client.Connect("smtp.office365.com");
    client.StartTLS();

    client.UseBestLogin("admin@your-domain.com", "your-password");
    ...
}

Reference -

I hope you are enjoying with this post! Please share with you friends. Thank you so much!