コード例 #1
0
function sendEmailMailjet($email, $titre_mail, $contenu_mail, $headers, $email_exp, $contenu_mail_txt)
{
    if (!isset($mailjet_apiKey)) {
        include 'config.php';
    }
    require_once 'includes/php-mailjet-v3-simple.class.php';
    $mj = new Mailjet($mailjet_apiKey, $mailjet_secretKey);
    $params = array("method" => "POST", "from" => $email_exp, "to" => $email, "subject" => $titre_mail, "text" => $contenu_mail_txt, "html" => $contenu_mail);
    $result = $mj->sendEmail($params);
    if ($mj->_response_code == 200) {
        $result = true;
    } else {
        $result = false;
    }
    return $result;
}
コード例 #2
0
ファイル: class.email.php プロジェクト: roaldnefs/parkingcity
 public static function send_mail($to, $subject, $message)
 {
     /* Maak het mailjet object aan, en geef de mailjet api sleutels mee. */
     $mailjet = new Mailjet(Config::$mailjet_keys['username'], Config::$mailjet_keys['secret']);
     /* Maak een array aan met de gevens die verstuurd moeten worden. */
     $array = array("method" => "POST", "from" => "*****@*****.**", "to" => $to, "subject" => $subject, "html" => str_replace('%message%', $message, Self::get_body()));
     /* Stuur de array met gegevens naar de API, en laat die de gegevens mailen. */
     $result = $mailjet->sendEmail($array);
     /* Controleren of het emailen gelukt is. */
     if ($mailjet->_response_code == 200) {
         /* Return een true. */
         return true;
     } else {
         /* Foutmelding, gooi deze. */
         throw new Exception('Er ging wat fout tijdens het versturen van een email. <i>' . $mailjet->_response_code . '</i>');
     }
 }
コード例 #3
0
 function sendEmail($email, $judul, $isi)
 {
     $mj = new Mailjet();
     $params = array("method" => "POST", "from" => $this->senderMail, "to" => $email, "subject" => $judul, "text" => $isi);
     //echo "success - email sent";
     return $mj->sendEmail($params);
 }
コード例 #4
0
 public function send_mail($subject, $title, $message)
 {
     $emails = get_option('um_emails', '');
     if ($emails != '') {
         $email = '';
         ob_start();
         include dirname(__FILE__) . '/mail.php';
         $email = ob_get_contents();
         ob_end_clean();
         $api = get_option('um_api', '');
         $secret = get_option('um_secret', '');
         $from = get_option('um_from', '');
         if ($api != '' and $secret != '' and $from != '') {
             $mj = new Mailjet($api, $secret);
             $params = array('method' => 'POST', 'from' => $from, 'to' => explode(',', $emails), 'subject' => $subject, 'html' => $email);
             $mj->sendEmail($params);
         } else {
             add_filter('wp_mail_content_type', function ($content_type) {
                 return 'text/html';
             });
             wp_mail($emails, $subject, $email);
             add_filter('wp_mail_content_type', function ($content_type) {
                 return 'text/plain';
             });
         }
     }
 }