php - MailJet api set HTML email text -


i using mailjet api. able send plain text email via mailjet. tried sending html mail reason not working. here code.

        include('mail.php');      $recipients = 'abc@gmail.com'; //change      $headers['from']    = 'admin@abc.com'; //change     $headers['to']      = 'abc@gmail.com'; //change     $headers['subject'] = 'test message';      $body = 'test message';      // define smtp parameters      $params['host'] = 'in.mailjet.com';     $params['port'] = '25';     $params['auth'] = 'plain';     $params['username'] = 'xxxxxx'; //change     $params['password'] = 'xxxxxx'; //change      // create mail object using mail::factory method      $mail_object =& mail::factory('smtp', $params);      // send message      $mail = $mail_object->send($recipients, $headers, $body); 

this code works perfect plain text. tried changing $params['auth'] = 'plain'; $params['auth'] = 'html'; didn't worked.

i have tried

    $message = new mail_mime();     $html = "<p>test message</p>";       $message->sethtmlbody($html);     $body = $message->get(); 

any appreciated.

here working code.

        include('mail.php');     include_once("mail/mime.php");      $recipients = 'abc@gmail.com'; //change      $headers['from']    = 'admin@abc.com'; //change     $headers['to']      = 'abc@gmail.com'; //change     $headers['subject'] = 'test message';         $message = new mail_mime(array('eol' => $crlf));         $html = "<p>test message</p>";         $message->sethtmlbody($html);         $body = $message->get();      // define smtp parameters      $headers = $message->headers($headers);      $params['host'] = 'in.mailjet.com';     $params['port'] = '25';     $params['auth'] = true;     $params['ishtml'] = true;     $params['username'] = 'xxxxxxx'; //change     $params['password'] = 'xxxxxxx'; //change      // create mail object using mail::factory method      $mail_object =& mail::factory('smtp', $params);      // send message      $mail = $mail_object->send($recipients, $headers, $body); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -