So, do you ever get email with images that need to be loaded because they are not or not properly attached to the email? I do, and I have to say I don't really like it. Of course, there is the trade-off that the email size will increase if they are attached to the email, but if the sender takes care the number and size of the images are small and therefor the size of the email should still be at an acceptable level.
I was looking for a solution for this in Magento, only to find that there was not yet an extension that provided this functionality. Since I wanted to have this for our Magentron.com website I decided to implement this as a new extension called EmailImages and release it to the public via Magento Connect: EmailImages.
The extension is pretty straightforward: if there are any image URLs used in the HTML body of the email message it downloads them, caches them (using the Magento cache with its own cache type so you can easily flush it) and attaches them to the email, changing the email content type to multipart/related. The configuration options in System -> Configuration -> Advanced -> System -> Email Images allow you to:
- enable/disable the functionality
- define the maximum time to cache the downloaded images (in seconds)
- supply a different regular expression
- supply a different regular expression index to use
The extension overwrites the models for Newsletters and Emails (specifically: core/email, core/template, newsletter/template). Unfortunately, there are probably many extension that rewrite these models also (e.g. the must-have extension ASchroder_SMTPPro), so please test this extension on a non-production environment only before installing it on a 'live' server. Please note that this is because of the way Magento is structured. If anyone has a better solutions, we are seriously interested to hear about it, so let us know if you do!
Because we believe that quality of software is very important, even for an open source project, we have taken the trouble to write PHPUnit tests using Ecomdev_PHPUnit. We have achieved 100% code coverage and even though that might not say much, at least all lines of code have been run in the unit tests. Because of this we already have prevented some issues to be present in the released version.
We hope that you will enjoy our extension and if you have any comment or feedback, we would love to hear it, so please take the trouble to contact us via the comments or the Contact Us page.
2 Responses to New Magento extension for automatically attaching images to emails
Please, does extension work in magento 1.6? I have same problem below (from http://www.magentocommerce.com/magento-connect/Magentron/extension/7254/magentron_emailimages/reviews#reviews)
"I have installed, and cleared cache, and signed out and in but does not show in Config-Advanced-System as in your image on this page."
Sorry my english
Thx
Posted on Fri October 7, 2011 at 12:30
Hi LUK,
I have added a comment on Magento EmailImages review page. Please check the comment, and continue the discussion there. Thanks.
Posted on Fri October 7, 2011 at 16:22