2

Which php library makes it easy to embed images into an email.

Bob Fanger
  • 28,949
  • 7
  • 62
  • 78
  • This thread seems like a very similar question: http://stackoverflow.com/questions/536838/php-attaching-an-image-to-an-email Although it wasn't asking for a library. – Tim Lytle Nov 17 '09 at 15:54

4 Answers4

2

Zend_Mail seems pretty easy. From the example code:

$mail = new Zend_Mail();
// build message...
$mail->createAttachment($myImage,
                        'image/gif',
                        Zend_Mime::DISPOSITION_INLINE,
                        Zend_Mime::ENCODING_8BIT);

If you want to reference the image in the HTML part of the e-mail, this SO thread may be useful.

Community
  • 1
  • 1
Tim Lytle
  • 17,549
  • 10
  • 60
  • 91
1

I did found htmlMimeMail5 which is quite nice.

Bob Fanger
  • 28,949
  • 7
  • 62
  • 78
1

Take a look at the PEAR packages related to this (Mail/Mime).

Here is the documentation: http://pear.activeventure.com/package/package.mail.mail-mime.addhtmlimage.html

Here is a sample: http://forums.devshed.com/php-development-5/need-an-example-for-embedding-image-using-pear-mail-mime-134461.html?p=615813

Palantir
  • 23,820
  • 10
  • 76
  • 86
1

We use http://swiftmailer.org/ and it's very good and easy to use if you send less emails eta less than 100 K per hour for bulk of emails, in that case it could be memory consuming. Generally it is good tool.

vaske
  • 9,332
  • 11
  • 50
  • 69