PHP code example of dps-software-srl / php-mailjet-lib

1. Go to this page and download the library: Download dps-software-srl/php-mailjet-lib library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dps-software-srl / php-mailjet-lib example snippets


 $_ENV['MJ_APIKEY_PUBLIC']  // Tokens de API de Mailjet
 $_ENV['MJ_APIKEY_PRIVATE'] // Tokens de API de Mailjet
 $_ENV['ENVIRONMENT']       // [ 'DEV' | 'TEST' | 'PROD' ] Si NO es PROD, aparecerá en el SUBJECT
 $_ENV['MJ_FROM_EMAIL']     // Email de salida
 $_ENV['MJ_FROM_NAME']      // Nombre de email de salida
 $_ENV['SEND_EMAILS']       // [ 'true' | 'false' ]

$pathToAttachment = $pathTo . '/info.jpg'
$text             = "Lorem ipsum <img src='cid:info.jpg'>dolor sit amet";
$status = Dps\Mailer::addAttachment( $pathToAttachment ) 
                    ::send( $to, $subject, $text );

$pathToAttachment = $pathTo . '/info.jpg'
$text             = "Lorem ipsum <img src='cid:info.jpg'>dolor sit amet";
$status = Dps\Mailer::addInlineFile( $pathToAttachment ) 
                    ::send( $to, $subject, $text );

$status = Dps\Mailer::addLogoAlPie( $pathToInlineAttachment )
                    ::send( $to, $subject, $text );

  $status = [
      'success' => true,    // boolean,
      'data'    => [ ... ], // Info de cada mensaje enviado con ID para seguimiento en MailJet
      'error'   => 'OK',    // string con el error, o 'OK' en caso de exito
  ];