04 June 2017

How to find the correct SMTP server settings so that you can Send Mail As from Office365 in Gmail

One of Gmail's (many) cool features is that it lets you check mail from other non-Gmail addresses and send mail from other addresses that you own. This allows you to manage all of your email from a single interface, and extends all of the benefits of Gmail to mail from your other non-Gmail accounts (labels, Google-powered search, etc.).


Set up Send Mail As

Here are Google's instructions for how to set up sending emails from a different address in Gmail:

Step 1: Add an address you own
  1. On your computer, open Gmail.
  2. In the top right, click Settings.
  3. Click the Accounts and Import or Accounts tab.
  4. In the "Send mail as" section, click Add another email address.
  5. Enter your name and the address you want to send from.
  6. Click Next Step.
  7. Enter the SMTP server (for example, smtp.domain.com) and the username and password on that account.
  8. Click Add Account.
Step 2: Confirm the address
  1. Sign in to the account you added.
  2. Open the confirmation message you got from Gmail.
  3. Click the link.
Step 3: Change the "From" address
  1. In the message, click the "From" line.
    (If you don't see this, click the space next to the recipient's email.)
  2. Select the address to send from.


Uh-oh, errors

When it works, it is a thing of beauty. The problem is that for some email addresses, these default steps do not cut it. This is particularly the case for Microsoft Exchange or the newer Office365 email addresses. Users with Microsoft work email addresses tend to run into trouble at step 1.7 when attempting to specify the SMTP server.

I have come across two errors. The first appears when using the default SMTP address without making any changes:
Couldn't reach server. Please double-check the server and port number.

Another error message came up when I used the recommended SMTP server for Office365 users (which is smtp.office365.com):
Authentication failed. Please check your username/password.
Server returned an error: "334 VXNlcm5hbWU6 334 UGFzc3dvcmQ6 535 5.7.3 Authentication unsuccessful [CY4PR16CA0035.namprd16.prod.outlook.com] code(535) "

Some people claim to have come across an error saying Server response: read error code(0), although I have not seen that error, myself.


So, what's the problem?

The problem is obviously that I was not specifying the correct SMTP server. You might think that the first step should be to contact IT support at work to obtain the correct SMTP address. IT Support do not understand what you are trying to do. They might tell you to use the recommended email client (most likely Outlook). You re unlikely to find a solution this way.

For me, this was very frustrating and led to a lot of searching and trawling through forums, trying to find a solution. The issue arises from the fact that the recommended SMTP server (smtp.office365.com) is not the final destination, but rather redirects to another SMTP server address based on your location (similar to how typing in Google.com will redirect you to Google.co.uk in England, but to Google.com.au in Australia).


How to find your Office365 SMTP server

In order to find your SMTP server, you must ping the smtp.office365.com address. And it is really easy to do.

On Mac, open Network Utility, click on the Ping tab, then enter the network address to ping, and click the Ping button. After a few seconds, a report will be generated, and at the top it will output something like this:
Ping has started…

PING outlook-au.office365.com

You could also open a Terminal window and type ping smtp.office365.com and then press Enter. After a few seconds it will start generating output. On the top line will be something like this:
PING outlook-au.office365.com

On Windows, open a Command Prompt window and type ping smtp.office365.com and then press Enter. It will start generating output, and the top line will look something like this:
Pinging outlook-au.office365.com

My particular SMTP server is outlook-au.office365.com. Entering this address as the SMTP server, my full Office365 email address as the username, and password worked when adding my Office365 address to Gmail.


No comments: