Problem with Mailx command to send mail with attachment

Hi,

I am using mailx command to send a mail with attachment. It's working fine, but with attachment I am getting one extra attachment like (ATT00131.txt). I have tried to use unix2dos command also. But still I am getting the extra attachment.

I am using the following code:

subject="temp subject"
mailto="sysuser"
file_name="rows.csv"

`(echo "Hi,";echo;
echo $message; echo;
echo "Please find the attachment." ;
echo;echo "Regards,";echo "System User";
uuencode "$file_name" "$file_name") | mailx -s "$subject" "$mailto"`

Please let me know how to resolve this problem, to get only one attachment.

Thanks
Viswanath

File ATT00131.txt is empty?
If not what is there in ATT00131.txt

It Contains below 2 lines.

`
end

Thanks
Viswanath

what is your OS? My OS is sun. I tried the same program but I haven't get any extra <A* .txt> file. I attached .txt and .xls file, both os them I received as it is.
Instead of mailx you can try the attachunix command.

Usage: /usr/lbin/attachunix [-t letter body] [-s subject ] [-m mail address] <attached files>

Hi,

After running my program If I check the mail in scalix, I am getting no extra files (ATT*).

But If I check same mail in MS Outlook 2003 it is attaching extra file (ATT*), which contain the `end characters.

I am using LINUX Server. Below is the server details.

$uname -a
Linux server1 2.6.9-42.7.ELsmp #1 SMP Tue Sep 5 18:25:41 EDT 2006 x86_64

Thanks
Viswanath

Hi All,

Thanks for the reply.
Below code is resolving my problem.

(
echo "To: $mailto"
echo "Subject: $subject"
echo "MIME-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"'
echo
echo '---q1w2e3r4t5'
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
echo $message
echo '---q1w2e3r4t5'
echo 'Content-Type: application; name="'$(basename $attachfile)'"'
echo "Content-Transfer-Encoding: base64"
echo 'Content-Disposition: attachment; filename="'$(basename $attachfile)'"'
uuencode --base64 $attachfile $attachfile
echo '---q1w2e3r4t5--'
) | /usr/sbin/sendmail $mailto

Thanks
Viswanath