I am using mailx command in shell script to send mail with output files as attachment to my email id.
When my colleague is running the shell script (script code mentioned below), he is getting the mail but without attachment. Attachment is appeared as junk characters in mail body.
But from my login the same script is running fine with the recipient mail id in script as xyz@abc.com and I am getting the mail with attachment and correct output. Also, when I send mail to anybody else then also they are getting junk characters in mail body and I am getting mail with correct output !!!
in my experience, not a good idea to send non-text files through mailx. you should modify your script in accordance with the above syntax. Instead of echo'ing, just pump the file to the email with '<'.
Since you are getting the correct output, then you know that your script works. However, not all email clients can cope with uuencoded attachments. You will have to attach files to your message using MIME, so perhaps consider using mutt.
If the recepient is an exchange server, put '-m' in front of the recepint. It happens in company, if no '-m', the recepient will receive a junk character in messge body.
You may try the following command :
(echo "\nPlease see the attachment for details.";awk 'sub("$", "\r")' attach_file | uuencode attach_file) | mailx -s "YOUR SUBJECT" -m recepient@aaa.bbb.com