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:
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.
-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.
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.