0

I installed mailx in my Linux webserver running CentOS 7. When I try to send a test email,

echo "Body test." | mail -r "fromemail@domain.com" -s "Subject Test" toemail@domain.com

I check my email and don't receive anything. However, if I use the mailq command, I get this:

postqueue: warning: Mail system is down -- accessing queue directly
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
7805D2DF        422 Wed Jan 11 15:00:40  fromemail@domain.com
                                         toemail@domain.com
1

mailx is a client, you still need an MTA like postfix/sendmail/exim, or specify a server

$ mailx -v -s "$EMAIL_SUBJECT" \
-S smtp=smtp://smtp.ust.hk \
-S from="$FROM_EMAIL_ADDRESS($FRIENDLY_NAME)" \
$TO_EMAIL_ADDRESS

source

Another Example

(options vary but I think this is right for rhl)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.