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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. Complete Hardware Reference : SPARC T5-2 / T5-4 / T5-8
  2. 7 Useful Find Command Examples to Locate files to remove when a filesystem is full
  3. How to enable or disable telnet in Solaris 10
  4. How to log SSH login attempts to a file in Solaris
  5. Solaris 11 : How to Control Allocated Bandwidth of Network Interface on Per App/User Basis
  6. How to check zpool status in Solaris
  7. How to enable XDMCP in GNOME Display Manager (gdm) for Solaris 10,11
  8. Beginners Guide to Configuring network virtualization features in Solaris 11
  9. Solaris : How to unconfigure and configure a cpu/memory board using cfgadm
  10. Solaris 11 : How to Verify Kernel Zone Support on a Host

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright