1752631 Members
5616 Online
108788 Solutions
New Discussion юеВ

Re: How to use mailx?

 
SOLVED
Go to solution
Ngoh Chean Siung
Super Advisor

How to use mailx?

Hi,

I want to use mailx command. Can I hv an example of the syntax?

Receipient - abc@yohoo.com
subject - test
content - this is just for testing

regards.
11 REPLIES 11
Peter Godron
Honored Contributor
Solution

Re: How to use mailx?

Hi,
echo "this is just for testing" | mailx -s"test" abc@yohoo.com

for files:
mailx -s "subject" recipient < file.txt
Steven E. Protter
Exalted Contributor

Re: How to use mailx?

Shalom Ngoh,

I use it via cron as follows

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Muthukumar_5
Honored Contributor

Re: How to use mailx?

echo "This is just for testing" | mailx -s "test" abc@yohoo.com

That is it.

--
Muthu
Easy to suggest when don't know about the problem!
Ngoh Chean Siung
Super Advisor

Re: How to use mailx?

Hi,

Thanks for ur reply.

1) What is the diff between mailx and sendmail?

2) As I know, we can configure mail relay host at /etc/mail/sendmail.cf. Is this setting only applicable for sendmail? How about mailx?

regards.
Peter Godron
Honored Contributor

Re: How to use mailx?

Hi,
mailx is the "frontend" for sendmail. So mailx uses sendmail.
Arunvijai_4
Honored Contributor

Re: How to use mailx?

Hello,

1) What is the diff between mailx and sendmail?

Sendmail is standard UNIX implementation of SMTP protocol. Where as mailx is frontend. More advanced front end is Pine.

2) As I know, we can configure mail relay host at /etc/mail/sendmail.cf. Is this setting only applicable for sendmail? How about mailx?

Nope. Read the above answer.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Arunvijai_4
Honored Contributor

Re: How to use mailx?

Hello,

1) What is the diff between mailx and sendmail?

Sendmail is standars UNIX implementation of SMTP protocol. Where as mailx is frontend. More advanced front end is Pine.

2) As I know, we can configure mail relay host at /etc/mail/sendmail.cf. Is this setting only applicable for sendmail? How about mailx?

Nope. Read the above answer.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Geoff Wild
Honored Contributor

Re: How to use mailx?

Actually, mailx just wraps email for sendmail.

In reality, if your sendmail.cf isn't configured correctly, then mailx won't work (to anything outside the box).

IE - if you havn't configured a smart relay in sendmail (DS), and your server doesn't "know" how to get to your email server, then, a mailx -s "test" you@yourdomain.com
Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Ngoh Chean Siung
Super Advisor

Re: How to use mailx?

Hi,

Per my understanding after went thru all the replies, the mailx will invoke the sedmail to send mail. Am I right?

Currently I'm facing a problem as described below.

Our mail relay server is Trend Micro IMSS.

In /etc/mail/sendmail.cf, I set the 'Smart' relay host to this IMSS.

By using root and sendmail command, the mail can be reached at IMSS but the IMSS treats it as a SPAM.

By using root and mailx command, the mail can be reached at IMSS and divert to the destination sucessfully.

Q1) Why above problem happens?
Q2) What is the diff between /etc/mail/sendmail.cf and /etc/mail/sendmail.cw?

regards.