Korn Shell code to send attachments with mailx and uuencode?
        Posted  
        
            by Nano Taboada
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nano Taboada
        
        
        
        Published on 2008-09-18T20:03:13Z
        Indexed on 
            2010/04/25
            6:03 UTC
        
        
        Read the original article
        Hit count: 584
        
I need to attach a file with mailx but at the moment I'm not having a lot of success. Here's my code:
subject="Something happened"
to="[email protected]"
body="Attachment Test"
attachment=/path/to/somefile.csv
uuencode $attachment | mailx -s "$subject" "$to" << EOF
The message is ready to be sent with the following file or link attachments:
somefile.csv
Note: To protect against computer viruses, e-mail programs may prevent
sending or receiving certain types of file attachments.  Check your
e-mail security settings to determine how attachments are handled.
EOF
Any feedback would be highly appreciated.
Update I've added the attachment var to avoid having to use the path every time.
© Stack Overflow or respective owner