Mailx sending but not receiving

Hi,

I need help with mailx. When I run the below mailx command, it works fine because the exit code is fine, and the message is sent to /usr/mail/<id>

echo "This is a test message" | mailx -s "Test" <my email address>

My question is, how do I get it to reach my email address (on outlook and not on /usr/mail)?

Thanks.

If you wanted someone else to send email to your outlook account, what e-mail address would you tell them to use? Presumably, it would be something like id@server.domain. Use that same address as the email address you give to mailx .

I hate mail problems they are not so easy to handle can spend up to days trying to fix mail issues. Most times related to dns or host resolution issues in /etc/hosts file or /etc/nsswitch.conf

from that server where you run the command is it allowed to send email to go out to internet?

do command
nslookup google.com

if cannot check /etc/resolv.conf if there are nameservers there check in /etc/nsswitch.conf if there is an entry
hosts: files dns

if you are only allow relay from this server to another server

1) what is your sendmail.cf DS pointing to? example DSsomemail means it's relaying to somemail server

try to telnet to the mail server at smtp port 25 send email from it see if you can receive.

root# telnet somemail 25
Trying somemail...
Connected to somemail.
Escape character is '^]'.
220 somemail ESMTP Postfix
mail from: darthvader
250 2.1.0 Ok
rcpt to: someone@gmail.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
test
.
250 2.0.0 Ok: queued as 16FA7160BA3
quit
221 2.0.0 Bye
Connection to somemail closed by foreign host.

if you can telnet and send email and receive it means it's could be some relaying configuration issues. If you cannot means there's also some other issue network dns firewall

I hate mail issues.