Unable to use mail command on CentOS 7

Hello,

I seem to be unable to get the mail command to send an email to my personal gmail address working. I'm running a Linode with CentOS 7.

Tried debugging from cli but I don't get any error or info that would get me any further.

CODE: SELECT ALL

➜ ~ echo "Your message" | mail -s "Message Subject" emailaddress

➜ ~ sudo echo "Your message" | mail -s "Message Subject" emailaddress

➜ ~ echo "Your message" | mailx -s "Message Subject" emailaddress

➜ ~ sudo echo "Your message" | mailx -s "Message Subject" emailaddress

CODE: SELECT ALL

telnet mail.messaging.microsoft.com 25

Trying 207.46.163.247…

Connected to mail.messaging.microsoft.com.

So I tried with mail and mailx but nothing is working. /var/log/maillog is empty.

Any advice is welcome to get this working.

WIllem

2 Replies

You need a MTA (mail transfer agent), like exim or postfix, then you need to read the documentation for the chosen MTA,

whatever it is, as each one has a different way to manipulate or check messages in the queue.

mail and mailx are just mail user agents (MUA), you need to know what happens with the MTA itself.

Thanks Sanvila,

Got is working now. My postfix service wasn't started.

systemctl start postfix

did the trick.

Grtz

Willem

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct