Advertisement
Guest User

Untitled

a guest
Mar 1st, 2018
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. <?php
  2.  
  3. define('SMTP_SERVER',''); // SMTP Server
  4. define('SMTP_PORT','25'); //Port
  5. define('SMTP_USER',''); //SMTP Username
  6. define('SMTP_PASS',''); //SMTP Passwort
  7. define('SMTP_ENCYPTION',''); //SMTP Verschlüsselung
  8. define('SMTP_FROM_NAME',''); //Absendername
  9. define('SMTP_FROM_EMAIL',''); //AbsenderEmail
  10. define('SMTP_FROM_TO','info@mediatpress.de'); //Empfänger Email
  11.  
  12. use PHPMailer\PHPMailer\PHPMailer;
  13. use PHPMailer\PHPMailer\Exception;
  14.  
  15. require 'vendor/autoload.php';
  16.  
  17.  
  18. $fmtResponse = file_get_contents("response.htt");
  19. $fmtMail = file_get_contents("mail.htt");
  20. $_POST['Details'] = implode("<br>",$_POST['feedback']);
  21.  
  22.  
  23. foreach($_POST['feedback'] as $key=>$value)
  24. {
  25.     $_POST['feedback'][$key] = str_replace("ZU_ERSETZENDER_STRING","ERSATZ_STRING",$value);
  26. }
  27.  
  28. foreach($_POST as $key=> $val) {
  29.     if($key == "feedback")        continue;
  30.     $fmtResponse= str_replace("<$key>", nl2br($val), $fmtResponse);
  31.     $fmtMail= str_replace("<$key>", nl2br(utf8_decode($val)), $fmtMail);
  32. }
  33.  
  34.  
  35.  
  36. if ($_POST["access"] == "irregeheim") {
  37.     $mail = new PHPMailer(true);
  38.     try {
  39.         //$mail->SMTPDebug = 2;
  40.         $mail->isSMTP();  
  41.         $mail->Host = SMTP_SERVER;
  42.         $mail->SMTPAuth = true;  
  43.         $mail->Username = SMTP_USER;
  44.         $mail->Password = SMTP_PASS;
  45.         $mail->SMTPSecure = SMTP_ENCYPTION;  
  46.         $mail->Port = SMTP_PORT;
  47.         $mail->setFrom(SMTP_FROM_EMAIL, SMTP_FROM_NAME);
  48.         $mail->addAddress(SMTP_FROM_TO);
  49.         $mail->addReplyTo(SMTP_FROM_EMAIL, SMTP_FROM_NAME);
  50.         $mail->isHTML(true);    
  51.         $mail->Subject = $_POST["subject"];
  52.         $mail->Body    = $fmtMail;
  53.         $mail->send();
  54.         echo $fmtResponse;
  55.     } catch (Exception $e) {
  56.         echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  57.     }
  58.    
  59.    
  60.    
  61.    
  62.    
  63. }
  64.  
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement