Office365 SMTP not working

I am trying to send SMTP email from the Linux mailx command; however, no matter how I try, the return from the server is always  Authentication unsuccessful.

I did:

  • Setup connector in Office 365 exchange to add my public IP addresses as trust

  • Setup an Office 365 account with an Essential subscription

  • Allow incoming & outgoing SMTP traffic over port 25 and 587 on my firewall for all Office365’s IP addresses

I tried to run:

mailx -v -s "Now is `date`" \
-S smtp-use-starttls \
-S ssl-verify=ignore \
-S smtp-auth=login \
-S smtp=smtp:// **** : **25** \
-S from="" \
-S smtp-auth-user="" \
-S smtp-auth-password="password" \
-S ssl-verify=ignore \ 

 And I always get the return below from the Office365 server.

535 5.7.3 **Authentication unsuccessful** [YQBPR0101CA0032.CANPRD01.PROD.OUTLOOK.COM]
smtp-server: 535 5.7.3 Authentication unsuccessful [YQBPR0101CA0032.CANPRD01.PROD.OUTLOOK.COM]
"/root/dead.letter" 11/388
. . . message not sent.

 I tried to change the following variables:

- Substitute smtp-auth-user="" with smtp-auth-user=“\myname”

Is there anyone successfully manage to get mailx working with Office365 SMTP?

Hi @pasi123456,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the Project Development Help and Advice board. No action is needed on your part; you can continue the conversation as normal here.


1 Like

I tried with telnet mail from in Windows PowerShell command and this is the result.

I found the resolution.

The issue is at the MX record’s IP address was not allowed in the firewall.

Also I had to request for IP and domain white listing in the Spamhaus.

Just for record, the SMTP Diag Tool at does work for Office365 SMTP testing.


The following answer helped me out in resolving my issue.On the contrary
I have another query in this regard that I am going through a problem that whenever
I am going ahead and trying to sign in to a Microsoft cloud service such as Office 365,
Microsoft Azure I am getting the following error message from
ADFS that "There was a problem accessing the site. Try to browse to the site again."I have contacted
the help desk and followed out their guidelines as told office 365 login .Suggest us if anything
I have missed out.

@pasi123456Dear friend,

This is a new issue for me (perhaps just coincidental - following a recent OS upgrade from Windows 10 Home to Windows 10 Pro).  An Windows 10 OS patch for January 2020 that I just installed also solved one other mail related issue for me that had popped up unexpectedly since last week.  Would you please explain the solution you’re referring to in simple “layman’s English” - that is, without using too much technical lingo?  More specifically, what are all the steps required to request for IP and domain white listing in the Spamhaus?  For reference, I am simply trying to send automated email messages using a Python program (which worked beautifully and perfectly up until my OS switch/upgrade to Windows 10 Pro) but apparently the email server is no longer recognizing my Hotmail / Outlook email account credentials.  It’s become a major headache for what I am trying to accomplish, especially after spending many hours/days to successfully figure out the programmatic email solution just days before the OS switch/upgrade.  Your timely help will be greatly appreciated.  Please note that I am not a naturally techie person but learning new things everyday.  So simpler explanation in plain English is preferred.  Sincere thanks in advance. R

Emails never deliver on office 365. doesn work any longer