Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************************
- * SEND EMAILS *
- *****************************************************************/
- function sendMail ($email) {
- require_once('includes/PHPMailer/class.phpmailer.php');
- $mail = new PHPMailer(true);
- $mail->IsSMTP();
- try {
- $mail->Host = MAILHOST;
- $mail->SMTPDebug = SMTPDEBUG;
- $mail->SMTPAuth = SMTPAUTH;
- $mail->CharSet = CHARSET;
- $mail->Username = MAILUSER;
- $mail->Password = MAILPASSWORD;
- $mail->Port = MAILPORT;
- $message = 'Nachricht';
- $mail->SetFrom(MAILFROM, MAILFROMNAME);
- $mail->AddAddress($email);
- $mail->Subject = MAILSUBJECT;
- ///Nachricht
- $mail->MsgHTML($message);
- if(!$mail->Send())
- {
- //$mail->Send() liefert FALSE zurück: Es ist ein Fehler aufgetreten
- echo "Die Email konnte nicht gesendet werden";
- echo "Fehler: " . $mail->ErrorInfo;
- }
- else
- {
- //$mail->Send() liefert TRUE zurück: Die Email ist unterwegs
- return true;
- }
- }
- catch (phpmailerException $e) { echo $e->errorMessage(); } //Pretty error messages from PHPMailer
- catch (Exception $e) { echo $e->getMessage(); } //Boring error messages from anything else!
- }
- // END MAIL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement