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.
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:// **smtp.office365.com** : **25** \ -S from="email@example.com" \ -S smtp-auth-user="firstname.lastname@example.org" \ -S smtp-auth-password="password" \ -S ssl-verify=ignore \ email@example.com
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.office365.com with resolved IP address
Port 25 with port 587
Is there anyone successfully manage to get mailx working with Office365 SMTP?