FOR Sending attachments using mailx below
Use the new attachment switch (-a) in mailx to send attachments with mail. The -a options are easier to use with the uuencode command.
# mailx -a file.txt -s "Subject" user@domain.com
The above command will print a new blank line. Enter the message text and press [ctrl] + [d] to send. This will correctly attach the file to the outgoing message with the appropriate Content-Type headers and borders.
To make this more "scriptable", you can send a message without a body with the following:
# mailx -a file.txt -s "Subject" user@domain.com < /dev/null
To send mail with the message body, replace / dev / null in the above command with your message body file.
Prem S Sep 26 '17 at 14:09 on 2017-09-26 14:09
source share