MSMTP throwing Errors while sending Mails using Outlook Mail Address

Hello Team,
I have RTIR 4.4.4 installed, have installed and configured msmtp as follows:

defaults
logfile /var/log/msmtp.log
account default
host myorg.mail.protection.outlook.com
port 25
user mail@my.org
password P@ssw0rd
from mail@my.org

When I try sending mails using msmtp using the above configuration:

  1. To the mails on the same domain I get the error

     <-- 501 5.1.3 Invalid address [DB8EUR05FT044.eop-eur05.prod.protection.outlook.com]
     msmtp: recipient address undefined not accepted by the server
     msmtp: server message: 501 5.1.3 Invalid address [DB8EUR05FT044.eop-eur05.prod.protection.outlook.com]
     msmtp: could not send mail (account default from /opt/rt4/etc/msmtp_wrapper.conf)
    
  2. If I send to other office365 mails I get the error

     <-- 451 4.4.62 Mail sent to the wrong Office 365 region. ATTR35. For more information please go to https://go.microsoft.com/fwlink/?linkid=865268 [AM6EUR05FT052.eop-eur05.prod.protection.outlook.com]
     msmtp: recipient address othermail@office365.com not accepted by the server
     msmtp: server message: 451 4.4.62 Mail sent to the wrong Office 365 region. ATTR35. For more information please go to https://go.microsoft.com/fwlink/?linkid=865268 [AM6EUR05FT052.eop-eur05.prod.protection.outlook.com]
     msmtp: could not send mail (account default from /opt/rt4/etc/msmtp_wrapper.conf)
    
  1. To gmail mails and other mail servers

     550 5.7.64 TenantAttribution; Relay Access Denied [VI1EUR05FT045.eop-eur05.prod.protection.outlook.com]
     msmtp: recipient address mail@gmail.com not accepted by the server
     msmtp: server message: 550 5.7.64 TenantAttribution; Relay Access Denied [VI1EUR05FT045.eop-eur05.prod.protection.outlook.com]
     msmtp: could not send mail (account default from /opt/rt4/etc/msmtp_wrapper.conf)
    

The msmtp command am running is:

$ echo "RT msmtp test" | sudo msmtp --debug -C /opt/rt4/etc/msmtp_wrapper.conf mailadrress@beingsent.to

Any insights on how to go about this will be super helpful and highly appreciated.

Seems like office 365 is complaining, is the account you’re relaying with setup to allow relaying?

@knation Good point, let me check that and retry the tests
Thanks