Email Multiple File Attachments From Solairs / AIX / HP-UX / UNIX / Linux Command Line

www.‮ruttual‬i.com
Email Multiple File Attachments From Solairs / AIX / HP-UX / UNIX / Linux Command Line

To email multiple file attachments from the command line on Solaris, AIX, HP-UX, or other Unix or Linux systems, you can use the mailx command.

mailx is a command-line mail client that can be used to send emails with attachments from the command line. It is included in most Unix and Linux distributions.

To send an email with multiple file attachments using mailx, follow these steps:

  1. Open a terminal and type the following command to send an email:
mailx -s "Subject" recipient@example.com < message.txt

Replace Subject with the subject of the email and recipient@example.com with the email address of the recipient. The message.txt file should contain the body of the email.

  1. To attach a file to the email, use the -a option followed by the name of the file. For example:
mailx -s "Subject" -a file1.txt -a file2.zip recipient@example.com < message.txt

This will attach the file1.txt and file2.zip files to the email.

  1. Press Ctrl + D to send the email.

You can also use the uuencode utility to attach binary files to an email. For example:

uuencode file.bin file.bin | mailx -s "Subject" recipient@example.com

This will attach the file.bin file to the email.

Note: You may need to configure the mailx command with your email server settings in order to send emails.

Created Time:2017-10-28 14:02:29  Author:lautturi