I've created a website that send information to users by e-mail (SMTP)
so, to more acceptable, I made a beatifull HTML template. Who worked with newsletter or e-mail marketing
knows that the mail clients (gmail, hotmail, yahoo, outlook, thunderbird, etc) has a lot of restrictions
non inline css and this is easly solved by Premailer lib (Ruby) (https://github.com/premailer/premailer).
There is a install version of this lib that I already installed:
:~$ gem install addressable -v 2.2.7
:~$ gem install premailer -v 1.7.1
Running this lib via SSH (using shell as a login shell), is working as expected.
so I made a little PHP script to run the command:
$body = base64_encode(file_get_contents('mail.html'));
$output = array();
$returnVar = 0;
$command = "echo $body | base64 -d | premailer ";
$response = exec($command, $output, $returnVar);
if ( $returnVar === 1 )
throw new Exception('Algo deu errado');
foreach ( $output as $line )
$line = trim($line);
echo $line ? $line . PHP_EOL : '';
and than run
php premailer.php via PHP CLI and works 100%
so running the same script via browser (here), nothing works.
I tried to login via
su <username> and the script is not working, but login in like
su -l <username>
my script runs as well,
I guess that is related width "shell as login shell"
There is a way to PHP run a command as