Find the answer to your Linux question:
Results 1 to 3 of 3
HellO.. How to send pictures with the mail command ?...if i want to send an html page with pictures included it always received in binary format......
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2004
    Location
    egypt
    Posts
    16

    sending picture with mail/sendmail


    HellO..

    How to send pictures with the mail command ?...if i want to send an html page with pictures included it always received in binary format...

  2. #2
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Montreal, Canada
    Posts
    1,267
    Here a site I found that seems to list all related comamnd to SendMail

    http://www.computerhope.com/unix/usendmai.htm
    http://www.computerhope.com/unix/umail.htm
    http://www.computerhope.com/unix/umailx.htm

    Hope it helps...
    \"Meditative mind\'s is like a vast ocean... whatever strikes the surface, the bottom stays calm\" - Dalai Lama
    \"Competition ultimatly comes down to one thing... a loser and a winner.\" - Ugo Deschamps

  3. #3
    Linux Newbie
    Join Date
    Dec 2006
    Posts
    105
    Sending binary files does not work well for the Internet. We could send a binary file "surfing.jpeg" using this command:

    mail -s "picture of me surfing" sylvia@home.com < surfing.jpeg

    but chances are high that the image will be unusable the time it arrives at the recipient.

    During mail delivery the mail is relayed from one mail delivery agent to the next, until it finally arrives at the recipient. Each delivery agent may transform the mail message, e.g. by stripping the 8th bit of each character, removing NUL bytes (ASCII code 0), converting the end-of-line character LF ("line-feed", ASCII code 12) to a local representation (e.g. CR LF), or removing trailing space or TAB characters from each line.

    Since only some characters are sure to arrive unmodified, the traditional solution is to encode the mail from binary format to a text format that is safe to transmit. The program used for this is called "uuencode" ("UNIX to UNIX encoding"), the program to decode the data is called "uudecode".

    The simplest way to send a file as a mail attachment is shown by the following example:

    $ uuencode surfing.jpeg surfing.jpeg | mail sylvia@home.com

    That's all! If Sylvia uses a current mail reader like Mozilla, Netscape Messenger or Microsoft Exchange, she will see a mail containing just one file attachment: the file "surfing.jpeg". In the command above we had to specify the file name two times: the first name denotes the input file to be encoded, and the second name is the file name the recipient will see.

    This way we can include normal text, too:

    $ (cat mailtext; uuencode surfing.jpeg surfing.jpeg) |
    mail sylvia@home.com

    Note: The file name "surfing.jpeg" again appears twice on the uuencode command line: the first time to specify the input file name, the second time for the remote extraction file name.

    The first "cat" will prepend the contents of the file "mailtext" to the "uuencode"ed data of the image "surfing.jpeg". Both commands are executed within a sub shell, to combine the output of both commands to one output stream redirected to the "mail" command.

    This method of sending file attachments works fairly well, but still has some shortcomings:

    * Many user agents cannot directly decode this kind of file attachments, e.g. "Eudora". Some mail agents explicitly require the decoding of the mail using the program "uudecode"
    * The "uuencode" encoding is not standardized. Text encoded on one system may not be decoded correctly by the recipient's system

    [the content of the mail message was saved to
    the file "mail.uue"]
    $ uudecode mail.uue
    The file "surfing.jpeg" was written to the current directory

    The next method does not have this disadvantages. It works with most (newer) mail user agents and uses the "Multipurpose Internet Mail Extensions" (MIME).
    Unix, Linux tips...

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •