I am getting this error in Magento 2.3. Error occurs with every email sent. enter image description here

CSS inlining error: DOMXPath::query(): Invalid expression in selector >> .fotorama__wrap:not(.fotorama__wrap--toggle-arrows) .fotorama__fullscreen-icon << in /var/www/html/magento2/vendor/pelago/emogrifier/src/Emogrifier.php on line 502

I have tried this method:

adding this file in app/design/frontend/VendorTheme/default/web/css/email.less

@import 'source/lib/email/stand/_lib.less'; // Global lib
@import 'source/lib/email/stand/variables/_email.less'; // Global email variables

I have also tried adding

"pelago/emogrifier": "1.0.0 as 0.1.1" in composer.json
  • what is your php version ? – Hafiz Arslan May 2 at 13:48
  • just downgrade the php version 7.3 to 7.2 every thing is working fine – Hafiz Arslan May 3 at 6:22

I've managed to fix the issue, is not the best practice, but it works.

Go to Marketing > Email Templates and create a new template. Click on Load template and load Magento_Email > Header.

In the Template Content field remove this line:

{{inlinecss file="css/email-inline.css"}}

A better solution would be to fix the issue in the file above.


Please do not use in your css code selectors with :not(), especially if after another selector follows to ':not' .This is necessary to aviod Еmogrifier errrors

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.