Advertisement
sofianels

MJ PHPMailer Basic

Jun 5th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?
  2. $mail = new PHPMailer(true);
  3.  
  4. $mail->IsSMTP();
  5. $sujet = "test";
  6. $message = 'essai mailing<br /><a href="[[UNSUB_LINK_FR]]">cliquez ici pour vous désabonner</a>';
  7.  
  8. try {
  9.   $mail->Host = "in.mailjet.com:25";
  10.   $mail->Username = "clé api";
  11.   $mail->SMTPAuth = true;
  12.   $mail->Password = "mot de passe api";
  13.   $mail->AddAddress('destinataire@domain.fr', 'nom destinataire');
  14.   $mail->SetFrom('expediteur@domain.fr', 'nom expéditeur');
  15.   $mail->Subject = $sujet;
  16.   $mail->MsgHTML($message);
  17.   $mail->Send();
  18. } catch (phpmailerException $e) {
  19.   echo $e->errorMessage();
  20. } catch (Exception $e) {
  21.   echo $e->getMessage();
  22. }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement