I cant seem to get this installed. I have followed the instructions here https://drupal.org/node/1130702

I have the libraries module enabled

I downloaded Emogrifier.php from https://github.com/jjriv/emogrifier/blob/master/Classes/Emogrifier.php

and placed it in \sites\all\libraries\emogrifier\emogrifier.php

Everything should be fine however I still get this warning:

Emogrifier class library The Emogrifier class library was not found.

Is there something I am missing? or is there a known issue/incompatibility?

Comments

tennisbear’s picture

I was having a similar problem. I fixed it by editing my copy of emogrifier.php and commenting out the second line:

// namespace Pelago;

Try that and see if it works for you.

jeff.k’s picture

OMG! Thank you. That did it. I was about to give up. Now on with testing.

jeff.k’s picture

Sadly it does not work for me. I am not sure if it broke because of the commenting out of that line or because of some other issue.

I am trying to send html emails using the bootstrap theme, not sure if there are issues with that.

Anyone have any ideas?

danreb’s picture

Title: Install Issue » Install Issue - Not compatible with latest Emogrifier Library

Change title, will add patch later...

danreb’s picture

Here's the patch for this problem, with this patch you don't need to modify any file in the downloaded emogrifier library.

jeff.k’s picture

Thanks for the patch although I am still not able to get this to work.

When I add this to my text format it just strips out all the classes. Both the sites display and emails sent contain only html tags

Is there any other special configuration I must do to get this to work?

Any help is greatly appreciated.

danreb’s picture

The emogrifier.module strips out all classes and id attributes and just leave the html tag with embedded style attributtes with it, it is because of this code near line 163 - 166 in emogrifier.module

  // Strip unwanted attributes.
  $text = preg_replace(
    array(
      '#(<[^>]*?)\s*class\s*=\s*(["\']).*?\2#si',
      '#(<[^>]*?)\s*id\s*=\s*(["\']).*?\2#si',
    ), '\1', $text);

So if you want to retain the classes and id's in html tag, just comment out these lines, you may want also to read the other similar problem here -> https://drupal.org/node/1842946 and it also have a patch which removes all the regular expression.

jeff.k’s picture

Sorry I don't think I was clear

The classes are being removed but there are no style attribute additions to reflect the classes being removed.

I will setup a test install with just this enabled and see if I have any luck there.

Ultimately I am trying to send emails that use the contents classes to render the style within the site.

danreb’s picture

Category: Support request » Bug report
sistro’s picture

I don't now if mine is the same issue.

I don't now where to put the emogrifier.php file, wherver I put it is not seen and i got the message: "The Emogrifier class library was not found."

I've tried this locations and tried to change to lowercase and uppercase letters:
libraries/emogrifier/emogrifier.php
libraries/emogrifier/Emogrifier.php
libraries/Emogrifier/Emogrifier.php

I also tried to downlonad entire master.zip files, unzip and rename folder to emogrifier so the path was:
libraries/emogrifier/Classes/Emogrifier.php

Please help me!

danreb’s picture

Hi,

If you don't know how to apply the patch, read on here -> https://drupal.org/patch/apply

Danreb

sistro’s picture

#11 Worked for me, thanks danreb!

geek-merlin’s picture

Status: Active » Needs review
StatusFileSize
new2 KB

I have reworked this to apply onto #1842946-8: Modify HTML code only by the Emogrifier library (that one is also critical and already rtbc).
Now this has a more verbose message where the library is expected.
Please test and set rtbc so we can get this in!

kissmedve’s picture

Status: Needs review » Reviewed & tested by the community

#13 works fine. Thanks! Setting to rtbc.

geek-merlin’s picture

Priority: Normal » Major
bennybobw’s picture

Neither of the patches worked on a clean copy of HEAD for me. Attaching a patch that matches the one in #13, but on clean head.

andrewj0seph’s picture

Continue to recieve "The emogrifier class library required by the emogrifier module could not be loaded." message. Have tried all patches including #16 - most have resulted in a WSOD. Emogrifier.php currently exists in /libraries/emogrifier/Classes
Not sure what I am doing wrong. Any help would be very much appreciated.

danreb’s picture

Hi Andrew,

Emogrifier.php should exists in sites/all/libraries/emogrifier/Classes/Emogrifier.php

Danreb

roball’s picture

@axel.rutz:

Please test and set rtbc so we can get this in!

Unfortunately, this module is unmaintained. No activity since 2 years, with critical bugs solved in the issue queue. Are you a new maintainer?

roball’s picture

Priority: Major » Critical
geek-merlin’s picture

i could commit to do the cleanup but i'm too busy to do maintainership alone.
anyone else to help? (if yes you may also pm me to get the ball rolling as i'm not too often in the issue queue...)

somatics’s picture

Is there a final resolution for this issue? I don't want to patch anything if it's causing a WSOD, and it's not clear to me from the thread if this has been solved and/or committed to the dev release.

I am getting this error, even though the library is present:

Emogrifier class library      Unavailable
The Emogrifier class library was not found.

Screenshot of the library installed is attached here:

Only local images are allowed.

Breakerandi’s picture

I tried every patch which has been committed here and nothing works.. still the library can't be found. I placed it in /sites/all/libraries/emogrifier/Classes/Emogrifier.php as usual.

DrCord’s picture

The patch in #16 worked perfect for me, the status report is now happy about the installation status of the emogrifier library.

rsbecker’s picture

I needed to make one change in the patch at #16 to make this work.

+  @include_once libraries_get_path('emogrifier') . '/Classes/Emogrifier.php';
+  return class_exists('\Pelago\Emogrifier');

It worked when I removed the @ before "include once ..."

I am using PHP 5.3.27. Don't know if that is the reason it didn't work as originally written.

DrCord’s picture

removing the @ symbol will allow that line to throw an error and not ignore it...not sure why that would fix it...

ndf’s picture

#16 works for me too.

kanghj’s picture

Ok, #16 works for me now too. But the styles are getting removed, and not inlined.

Anonymous’s picture

#1 worked for me.

// namespace Pelago;

queenvictoria’s picture

StatusFileSize
new11.8 KB

I've rerolled #13 so it applies cleanly to HEAD. Not the right thing to do but until we get a new maintainer...

alexdezark’s picture

Nothing works for me.

Why don't you give a "ready-to-use" patched file instead of a patch ?

I'm trying to use "commerce invoice recept" for 2 days, same with "commerce email", they all needs emogrifier and emogrifier is not detected by Drupal...

I tried to apply the patch (#30) with Eclipse and the file just disappear... I'm not a Patch'man and I really need something working.

Is there a solution ?

tostaky’s picture

#16 worked.
But do not mix the two proposals:
#16 does not seem to work if you comment // namespace Pelago

alexdezark’s picture

Am I so stupid ?

I tryed to apply #16 and #30 (separately with new module and new database each time) with the command line :
git apply -v '/path-to-the-patch'

My terminal says :

Checking patch emogrifier.install...
Checking patch emogrifier.module...
Applied patch emogrifier.install cleanly.
Applied patch emogrifier.module cleanly.

I checked the files, they look ok.

Then I enable emogrifier module, then I checked my clipboard and :

Emogrifier class library Unavailable
The Emogrifier class library was not found. Usually it is expected in sites/all/libraries/emogrifier/Classes/Emogrifier.php

Could you please give me a working patched zipped module ?

thanks in advance

alexdezark’s picture

OK everything is working now !
it was the rights that are inadequate on the folder 'Classes'...

Thanks a lot.

tarasiadis’s picture

#16 works for me too.

griz’s picture

The patch in #16 works for me too. I'd say this needs to be committed but I wonder if this module will ever be updated.

jnicola’s picture

You can report this module as needing a new maintainer and take over maintainership yourself to implement these patches. Pretty easy process really.

ndf’s picture

Version: 7.x-1.x-dev » 7.x-2.0-beta1
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

wdseelig’s picture

Am unable to install 7.x-2.0-beta1.

I am getting error messages for lines 91,96, 101, and 106 in the sites/all/libraries/emogrifier/Classes/Emogrifier.php file.

The errors mostly involve square brackets [] that PHP says are unexpected.

Simply quoting them does not fix the problem.

Wyckham

dasginganinja’s picture

wdseelig, The error you are experiencing is due to the fact that you have a PHP version before 5.4.0.

svouthi’s picture

Simply copying Emogrifier.php to a new Classes folder as in comment #18 worked for me.