I need to send an email with a text file as attachment using shell script in HP-UX; I don't have mutt installed.
I am using following command but it sends the file content in body of email, I want it as an attachment.
mailx -s "Report" name@example.com < file.txt
I also encountered the same problem few months ago.
The command I needed was
ux2dos
I hope it can help !
Regards
uuencode
is your friend.Here is a tested example:
I was having the same problem where the output of uuencode was being sent as part of the message body rather than as an attached file (at least when using Outlook 2010 to view the sent mail). I found the answer in this thread http://www.unix.com/hp-ux/41306-sending-attachments-through-mailx.html
Adding -m causes mailx to not add MIME header lines when sending email. The OP's command would be altered to look like:
mailx -m -s "Report" name@example.com < file.txt
I wrote this
ksh
function a few years ago