Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sending MIME email in PHP

    I wish to create a script on my site that allows a user to e-mail a picture to a friend.

    I can do the e-mail bit easily enough - but I want to include the picture as an attachment.

    I know i need to use MIME email for this but cant find any useful links on how to get started - anything out there is a bit too complex.

    does anyone know any simple starter tutorials? and/or have some code lying around?
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk

  • #2
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you would have to include something in the headers. I've seen it before, but I don't know it right off the top of my head.
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hold the presses.....

    I found and adapted a script that does the job:

    www.whatsinmypocket.co.uk/sweenster/php/mail.txt

    which works ok BUT when the "image" arrives in your email it is still in code form. I think the problem comes down to this chunk:

    PHP Code:
      // Add file attachment to the message
      
    $message .= "--{$mime_boundary}\n" .
                  
    "Content-Type: {$fileatt_type};\n" .
                  
    " name=\"{$fileatt_name}\"\n" .
                  
    //"Content-Disposition: attachment;\n" .
                  //" filename=\"{$fileatt_name}\"\n" .
                  
    "Content-Transfer-Encoding: base64\n\n" .
                  
    $data "\n\n" .
                  
    "--{$mime_boundary}--\n"
    As I nabbed.. erm I mean... "borrowed" this code from a script that orignally handled file uploads i think I need to replace the variables $fileatt_name and $fileatt_type with values so that they are JPEG compatible.

    Any suggestions??
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk


  •  

    Posting Permissions

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