Linux mail command : -f param
Hello,
the following command works properly on 1 Linux (CentOS) box and not on another : Code:
echo "test" | mail -s "subject" info@domain.tld -- -f noreply@domain.tld On the not-working CentOS, the mail is send to the following recepients : noreply@domain.tld -f@servername.domain.tld --@servername.domain.tld info@domain.tld The mail-addresses noreply@domain.tld, -f@servername.domain.tld, --@servername.domain.tld of course do not exist. How can you explain the difference in the "-- -f noreply@domain.tld" parameter of the mail-command ?? |
I'd check OS versions, update levels and env settings eg locale.
Maybe mail is symlinked to something else like mailx, nail etc |
On the working server, this is the situation :
-rwxr-xr-x 1 root mail 84856 jan 7 2007 mail lrwxrwxrwx 1 root root 4 nov 16 2011 mailx -> mail On the not-working server, this is the situation : lrwxrwxrwx. 1 root root 5 okt 10 15:07 mail -> mailx -rwxr-xr-x. 1 root root 378784 aug 22 2010 mailx |
Well, there you go :) , you're actually using 2 different 'mail' programs.
In fact, in mailx, the -f switch says Quote:
Either use the same prog on both systems OR use the correct flags in each case. |
Chris,
is there an easy way to switch to using the mail-command also on server 2 ?? How can I reverse the symlink ? |
I'm not Chris, but I'm going to take a shot at this anyway.
"is there an easy way to switch to using the mail-command also on server 2 ??" Yes. Remove the link on the second, "non-working" server that points the mail comand to mailx. This will only work if the program "mail" is installed on the non-working server. And it probably isn't. That's why there is a link from the command mail to the program mailx. So my suggestion is to use mailx on the "non-working" server and mail on the other one. Or, you can install mail on the second server. Or (my preference, all other things being equal) you can install mailx on the first server and then only use mailx. HTH, Jim |
How do I install the program "mail" ?
What I have installed is sendmail and mailx. When I remove mailx on the second server, there is no mail-command also. I have re-installed sendmail and mailx in different sequences, but I do not get the situation as on the working server. |
Quote:
Just install mailx on both and check you've actually got mailx as a program, not a symlink. Maybe its a version issue; can you tell us what versions of Centos you have. On my Centos 6.3, the default install is mailx as the real program and mail as a symlink thereto. |
You could be right.
Working CentOS : v5.8 Not-working CentOS : v6.3 I would like to use the simpel mail-command on both, not the mailx-command. Is that possible ? |
A quick look through my 6.3 implies mail is no longer available
Code:
yum search mail Feel free to try those cmds on both your systems. You can always check the Centos site and look into the rpm downloads to double check. |
All times are GMT -5. The time now is 04:10 PM. |