Logo Background

Unix Send Mail With Attachment

  • By on June 18, 2009 | No Comments

    You can usually send e-mail from Unix by using the command such as cat <file_name> | mail unix.guru@allguru.net

    But this command was pretty limited when it comes to sending attachment to the recipient’s e-mail.

    Whenever you use the mail command, the SMTP mail relay will help you to send the e-mail to the recipient.

    But the in middle of the mail relay, mail delivery agent may transform you mail content by stripping 8th bit of each character.

    Sometimes it does remove the NULL bytes where ASCII code 0, or remove the trailing space from each line.

    So it will be a problem to send email attachment using  cat <file_name> | mail unix.guru@allguru.net

    To ensure the file attachment arrived with alteration, the simple solution was to encode the mail from binary format to a text format before transmit.

    The program used for this is called uuencode (“Unix to Unix encoding”) and the program to decode the data is called uudecode.

    You may send multiple file as a mail attachment is shown by the following example:

    $ uuencode oracle.jpeg erp.jpeg | mail unix.guru@allguru.net

    Just for your info, the command below works only in Linux platform.

    Previous
    Next
    » Oracle Applications Cloning Process
Leave a Comment