mailx not working but sendmail is working

1.2k Views Asked by At

Recently my production server has been upgraded. after that our mailx command is not working. it is sending the mail without attachment and then there is junk character in mail. error is like.

Hello Team,

Please find the attached list of files which have been purged.

Regards,
Axiom Tech Support
begin 644 purge_files_2018-07-07.log.gz
M'XL("&,005L``W!U<F=E7V9I;&5S7S(P,3@M,#<M,#<N;&]G`-2=6V^<-Y*&
M[^=7]/4"M'DF*W>)DVQF,3/Q1@[V8K!H%,DJ6[`L"9*3&<^OGY=JM91(:K5R
ML=W?.@8LRVZ#1=;A>8N'_-V6U_CIK:LKE[ZR^&G_]ZO5R6>Y7+GY*U]]7OUR
MN;K0U>4O5^]E/?@SK\?IU?6KC]<?_O0?__<__K2Z^>_OSPS4?[5ZB\&=GK]?
MG7S]=C6'N%*1<;VZ.!MRM?K\@<]7KEK\R9?K`XWYN?&&^_&^.?EI&>/=,<?N
MJ3'_\.-//Y_\_QAVO!_VG_]V\N[KO[WY;O7?[WY:_=>/WYS<#EY/SV1AGO+4
MK/_YAS?+F?(_,.UG%^^?F.)TN!&_YLO+Z]?\S].+3VM\N?FJO,:XKE]?R]6O

the existing command was like

uuencode purge_files_2018-07-07.log.gz  purge_files_2018-07-07.log.gz   | mailx "Subject:Purge file";echo -e "\nHello Team,\n\nPlease find the attached list of files which have been purged -s [email protected]

now I have replaced it with

echo "Subject:Purge file";echo -e "\nHello Team,\n\nPlease find the attached list of files which have been purged.\n\nRegards,\nAxiom Tech Support";/usr/bin/uuencode purge_files_2018-07-07.log.gz purge_files_2018-07-07.log.gz)|/usr/sbin/sendmail -t "[email protected]"

So my question is why mailx is not working but sendmail is working. actually i will have to change in multiple scripts so I am seeking the solution.

1

There are 1 best solutions below

0
Vincent On

Mailx upgrade switched it to use MIME as mail content instead of plain text. Your email client does not recognise uuencoded content within MIME.

You can stop using uuencode and switch to

mailx -a <filename>