Results 1 to 4 of 4

Thread: Send images into the mail

  1. #1
    Join Date
    Jul 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Send images into the mail

    HI! ...Can someone tell me haw can i send an email with pictures. I know a way by putting the link to the images(for example: <img src="http://picture.jpg">) ...but i need to send a picture into the mail ...and when you open the mail you will see that picture into that mail ...not atached to that mail.
    THANKS!!!

  2. #2
    Join Date
    Jun 2006
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    <?php
    
    //variables
    
    $to = //your email address
    $subject = //subject
    $headers = "MIME-Version: 1.0\r\n".
       "Content-type: text/html; charset=iso-8859-1\r\n".
       "From: Whoever";
     
    $message = "
    <html>
    <body>
    <img src=\"http://www.yoursite.com/yourimage.jpg\"border=\"0\" alt=\"\">
    </body>
    </html>
    ";
    
    //Mail Function
    
    mail($to,$subject,$message,$headers);
    echo "Your picture has been sent!";
    
    ?>
    Hope that helps, if not, sorry.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It is possible, but it's a little complex. You must be using MIME email. You can then send the boundary followed by the headers:
    Code:
    Content-Type: image/gif
    Content-Transfer-Encoding: base64
    Content-ID: <part2.04060903.01030906>
    This is followed by two CRLFs, the image in base64_encode()ed format, another CRLF, then the boundary. You can then reference the image by its Content-ID, like so:
    Code:
    <img
     src="cid:part2.04060903.01030906">
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jul 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the answer!!!

    Thanks viper102464 ...but that write into the email message the url to the image ...and when you open the email they ask you if you want to see the picture or not ....but if you do it like Tway said then you will see the image widout asking you if you want to see the picture or not.

    Thanks Twey!!! ...that is what i needed!
    THANKS A LOOOTTT!!!
    Last edited by dardanel; 07-21-2006 at 03:50 PM.

Bookmarks

Posting Permissions

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