Advertisement
chrisiv

Untitled

Sep 17th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.18 KB | None | 0 0
  1. <?php
  2.  
  3. //php_mailer verwenden
  4. require 'src/Exception.php';
  5. require 'src/PHPMailer.php';
  6. require 'src/SMTP.php';
  7. use PHPMailer\PHPMailer\PHPMailer;
  8. use PHPMailer\PHPMailer\Exception;
  9.  
  10.  
  11. $mail = new PHPMailer(true);                                // Passing `true` enables exceptions
  12. try {
  13.     //Server settings
  14.     $mail->SMTPDebug = 0;                                   // Enable verbose debug output
  15.     $mail->isSMTP();                                        // Set mailer to use SMTP
  16.     $mail->Host = 'smtp.web.de';                            // Specify main and backup SMTP servers
  17.     $mail->SMTPAuth = true;                                 // Enable SMTP authentication
  18.     $mail->Username = 'emailadresse';                // SMTP username
  19.     $mail->Password = 'passwort';                          // SMTP password
  20.     $mail->SMTPSecure = 'tls';                              // Enable TLS encryption, `ssl` also accepted
  21.     $mail->Port = 587;                                      // TCP port to connect to
  22.  
  23.     //Recipients
  24.     $mail->setFrom('emailadresse');
  25.     $mail->addAddress($email);              // Add a recipient
  26.    
  27.    
  28.     //Content
  29.     $mail->isHTML(true);                                    // Set email format to HTML
  30.     $mail->Subject = 'Registrierung bei xxxx';
  31.     $mail->Body    = 'Vielen Dank für Ihre Anmeldung auf xxxx. </br>
  32.                      Ihre Daten werden zurzeit geprüft. </br>
  33.                      Sie erhalten weitere Informationen in den nächsten Tagen. </br>
  34.                       Mit freundlichen Gtüßen xxx xxx';
  35.     $mail->AltBody = 'Vielen Dank für Ihre Anmeldung auf xxx. \n
  36.                      Ihre Daten werden zurzeit geprüft. \n
  37.                      Sie erhalten weitere Informationen in den nächsten Tagen. \n
  38.                       Mit freundlichen Gtüßen xxx xx';
  39.  
  40.     $mail->send();
  41.     echo '<h1> Die Registrierung wurde versandt und wird in nächster Zeit geprüft.</h1> </br>
  42.          <b> Kehren Sie zur <a href="http://xxxx">Startseite</a> zurück.';
  43. } catch (Exception $e) {
  44.     echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo ,'</br>
  45.          Bitte kontaktieren Sie xxx. ';
  46. }
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement