Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. /*****************************************************************
  2. * SEND EMAILS *
  3. *****************************************************************/
  4. function sendMail ($email) {
  5. require_once('includes/PHPMailer/class.phpmailer.php');
  6. $mail = new PHPMailer(true);
  7. $mail->IsSMTP();
  8.  
  9. try {
  10. $mail->Host = MAILHOST;
  11. $mail->SMTPDebug = SMTPDEBUG;
  12. $mail->SMTPAuth = SMTPAUTH;
  13. $mail->CharSet = CHARSET;
  14. $mail->Username = MAILUSER;
  15. $mail->Password = MAILPASSWORD;
  16. $mail->Port = MAILPORT;
  17. $message = 'Nachricht';
  18.  
  19. $mail->SetFrom(MAILFROM, MAILFROMNAME);
  20. $mail->AddAddress($email);
  21. $mail->Subject = MAILSUBJECT;
  22. ///Nachricht
  23. $mail->MsgHTML($message);
  24.  
  25. if(!$mail->Send())
  26. {
  27. //$mail->Send() liefert FALSE zurück: Es ist ein Fehler aufgetreten
  28. echo "Die Email konnte nicht gesendet werden";
  29. echo "Fehler: " . $mail->ErrorInfo;
  30. }
  31. else
  32. {
  33. //$mail->Send() liefert TRUE zurück: Die Email ist unterwegs
  34. return true;
  35. }
  36.  
  37.  
  38. }
  39. catch (phpmailerException $e) { echo $e->errorMessage(); } //Pretty error messages from PHPMailer
  40. catch (Exception $e) { echo $e->getMessage(); } //Boring error messages from anything else!
  41. }
  42. // END MAIL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement