• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to send mails with attachments using the solaris mailx command

By admin

The post discusses the use of uuencode to send mails with attachments using mailx command. uuencode can also be used to sent multiple attachments.

1. Example using one attachment
The syntax of uuencode command is :

# uuencode [path of file to be encoded] [file to encode] >> [uuencoded filename]

For example if you have a file named my_file in directory /var/tmp, use the command as :

# uuencode /var/tmp my_file >> my_attachment
# mailx -s "This is a mial with only one attachment" john@example.com < my_attachment

The first line encodes the file “my_file” and creates the file “my_attachment”. The second line uses mailx to send the file “my_attachment” to john@example.com with a subject line of “This is a mail with only one attachment”.

2. Example using 2 attached files

# uuencode /var/tmp my_file01 >> multi_attachment
# uuencode /var/tmp my_file02 >> multi_attachment 
# mailx -s "Mail with multiple attachment" john@example.com < multi_attachment

The first line encodes the file “my_file01” and creates the file “multi_attachment”. The second line encodes the file “my_file02” and appends the encoded data to the file “multi_attachment”. The third line sends the encoded file “multi_attachment” to the user.

3. Using uudecode
mailx is a text-based mail agent. It does not contain the MIME (“Multipurpose Internet Mail Extensions”) standard. Examples 1 and 2 use the uuencode command to encode the file. Most modern mail user agent (MUA) used to receive the messages will recognize and decode the files automatically. If the mailx message and uuencoded attachment is received by mailx (or similar non-MIME MUA), then use uudecode to retrieve them:

# uudecode multi_attachment
Linux / UNIX : How to send mails with attachments using mailx command
Linux / UNIX : Send mail with attachment using mutt

Filed Under: Solaris

Some more articles you might also be interested in …

  1. How to Create a Datalink in Non-Global Zone from the Global Zone in Solaris 11
  2. Solaris 11 : How to monitor network traffic using “ipstat”, “tcpstat” and “netstat” commands
  3. Troubleshooting Solaris IPMP
  4. Solaris : How to create processor set (pset) and associate it with a pool
  5. The ultimate Solaris jumpstart troubleshooting guide
  6. How to create or change or view Boot Device Aliases in Solaris Online
  7. How to Configure a Solaris 10 Jumpstart server and client [SPARC]
  8. How to run savecore (crash dump) manually in Solaris
  9. Complete hardware reference : M3000 / M4000 / M5000 / M8000 / M9000
  10. Solaris 10 (x86/x64) : How to boot into single user mode from the Grub boot loader

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary