CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Inline images in mass mailings
Pages: [1]

Author Topic: Inline images in mass mailings  (Read 1138 times)

goran

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 3
Inline images in mass mailings
February 08, 2011, 01:56:10 am
As majority of our target mail clients are outlook users we have constant request to try to prettify the mailings.

Personally I would prefer not increasing the mail traffic several times just for some eye candy, but the feature had been requested and insisted on in almost every strategic meeting.

I guess I can justify it with following rationale:
- if CiviMail allows for attachments and if these attachments are images then there is no waste of resources if it would be possible to use those images from the attachment in e-mails html instead of http images.

So, I hacked a working solution by changing

Code: [Select]
CRM/Mailing/BAO/Mailing.php
and replacing the line

Code: [Select]
$message->addAttachment( $attach['fullPath'],
                                               $attach['mime_type'],
                                               $attach['cleanName'] );

with

Code: [Select]
$message->addHTMLImage(  file_get_contents($attach['fullPath']),
                                                $attach['mime_type'],
                                                $attach['cleanName'],
                                                false );

which did not work at first as because there seem to be some bug in packages/Mail/mime.php (which I could not completely understand and didn't have time to examine in depth, reported it but got can't reproduce status). Still, when I commented the

Code: [Select]
if (isset($this->_headers['From']))
in function &get (this one is supposed to make oid reference include the domain, which is not essential and is somehow broken).
 
After this - success: CiviCRM was happy to send out mailings with images encoded inline which works nicely in Outlook (2003 and 2007) and Thunderbird - instant display without user needing to confirm it.

Gmail still does not show them by default and you are required to allow it.

The above is just proof of concept (by simply replacing the attaching code it now does not handle normal attachments very well :) ), but I though I should share it and see if there is interest to do it and, more importantly, comments on how to do it properly.

Best,
Goran

cesy

  • I’m new here
  • *
  • Posts: 24
  • Karma: 3
    • Dreamwidth blog
Re: Inline images in mass mailings
June 19, 2011, 01:37:23 am
I'd be interested in this.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Inline images in mass mailings

This forum was archived on 2017-11-26.