SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    3 Post(s)
    0 Thread(s)

    Embed Images with PHPMailer

    I'm trying to email an embedded image in an email using PHPMailer, its not working, the image is not coming through. (I get a broken image)
    Heres the image upload part (the image to be embedded)
    HTML Code:
    <label for="Photo1">Image 1:</label>
    <input type="file" id="Photo1" name="image1" size="28" />
    and here's the phpMailer script to attach the image.
    PHP Code:
    $Image1 $_FILES['image1'];

    What am I doing wrong?
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Kathmandu, Nepal
    0 Post(s)
    0 Thread(s)
    I think you have't done it properly. The only code above will not work.You need to have some token to pass from here. Like you should have a token ID in your HTML:
    HTML Code:
    <img src="cid:1001" width="182" height="75">
    Here note the token code "1001" with 'cid' where 1001 is the predefined code as far as i know which we cannot change. And if you want to embed more than one image in the email then you should have another token that means unique token id.

    And now you should do the following to embed in PHP:
    PHP Code:
    Hope this will help you out there.
    Mistakes are proof that you are trying.....
    PSD to HTML - | Personal Blog | ZCE - PHP 5


Posting Permissions

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