Im using gmail-api to send emails to different contacts from my database. When i send the message, the styles dont work as this is happening because the equal symbol "=" is lost.
For example, in putting this in the message
<img src="mysite.com/image.jpg"/>
But instead i got this where i put =
<img src"mysite.com/image.jpg"/>
This is the part of my function where i make the string for the message
$strSubject = $data['subject'];
//$strRawMessage = "From: myAddress<pblanco@mysite.com>\r\n";
$strRawMessage = "From: <".$data['from'].">\r\n"; //email consultor
//$strRawMessage .= "To: toAddress <pblanco@mysite.com>\r\n";
$strRawMessage .= "To: <".$data['to'].">\r\n"; //email destinatario
$strRawMessage .= 'Subject: =?utf-8?B?' . base64_encode($strSubject) . "?=\r\n"; //asunto
$strRawMessage .= "MIME-Version: 1.0\r\n";
$strRawMessage .= "Content-Type: text/html; charset=utf-8\r\n";
$strRawMessage .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n\r\n";
$strRawMessage .= $data['message']."\r\n"; //mensaje
// The message needs to be encoded in Base64URL
$msg = $this->createMessage($strRawMessage);
And here i do the encoding for the message
public function createMessage($string){
//$mime = rtrim(strtr(base64_encode($string), '+/', '-_'), '=');
$mime = strtr(base64_encode($string), array('+' => '-', '/' => '_'));
$message = new Google_Service_Gmail_Message();
$message->setRaw($mime);
return $message;
}
I tried with different methods on my function createMessage() but im still having this issue.