LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   using mailx to send an attachment in Redhat 6 (https://www.linuxquestions.org/questions/linux-newbie-8/using-mailx-to-send-an-attachment-in-redhat-6-a-4175519312/)

bachmanne 09-18-2014 12:24 PM

using mailx to send an attachment in Redhat 6
 
We are moving an application from Solaris to Linux Redhat 6. We used the following code to send an attachment using mailx. I was told Redhat 6 mailx had that functionality without using uuencode. Can someone tell me how to convert the current code to not use uuencode:

# mail attachment
cat $lv_attach \
| uuencode `basename $lv_attach` \
| mailx -s "$lv_subject" $lv_mailaddr 2>/dev/null

Thank you

dayid 09-18-2014 12:37 PM

From the mailx manpage:
Code:

  -a file
              Attach the given file to the message.

Code:

echo "Message contents" | mailx -s "Subject" -a "/path/to/file" recipient@example.com


All times are GMT -5. The time now is 01:29 AM.