uSked / mosaico-php-backend

A PHP backend for Mosaico
GNU General Public License v3.0
32 stars 34 forks source link

don't manage to get premailer up #3

Open bwl21 opened 8 years ago

bwl21 commented 8 years ago

When I try do do a "Download" of my composed email i get:

screenshot_390

The attempt to send a test mail yields an empty email (but it is sent ...)

I tried the premailer endpoint (http://premailer.dialect.ca/api/0.1/documents) in the browser but it yields an error.

I tried to dive into it, it seems that in the snippet

        curl_setopt_array($cu, $data_conf);
        $exec = curl_exec($cu); 
        $_res           = json_decode($exec);
        $_res_info  = json_decode(json_encode(curl_getinfo($cu)));  
        curl_close($cu);

$exec is always empty ..

bwl21 commented 8 years ago

Maybe it makes more sense to use something like https://github.com/crossjoin/PreMailer

mherbold commented 8 years ago

Good find - however that project seems to be in its infancy is not as mature as http://premailer.dialect.ca

I will look into adding the crossjoin PreMailer as an alternate option.

mherbold commented 8 years ago

As for the original issue - is it possible that curl is not installed / enabled for PHP for you?

bwl21 commented 8 years ago

I double checked ... curl is enabled on my system.

screenshot_392

bwl21 commented 8 years ago

I proposed to do the inlining on the client side. See https://github.com/voidlabs/mosaico/issues/54

bwl21 commented 8 years ago

I nailed the issue down. It is when there is an error in curl_exec. We should capture this in line 91 of premailer.php

        $exec = curl_exec($cu); 
        if ($exec == false){
           throw new Exception ("curl erorr " . curl_error($cu));
        }

Anyhow exceptions should be properly reported back such that mosaico can handle them.