Guest User

Untitled

a guest
May 23rd, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <pre><?php
  2. print_r($_POST);
  3. ?></pre>
  4.  
  5. <?php
  6.  
  7. require_once('../lib/phpmailer/class.phpmailer.php');
  8. include("../lib/phpmailer/class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
  9.  
  10. $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
  11.  
  12. $mail->IsSMTP(); // telling the class to use SMTP
  13.  
  14. try {
  15. $contents = file_get_contents('mail-templates/OfferingMemorandum.php');
  16. foreach($_POST as $k => $v) {
  17. $contents = str_replace('{'.$k.'}', $v, $contents);
  18. }
  19.  
  20. $mail->SMTPAuth = true; // enable SMTP authentication
  21. $mail->Host = "72.1.71.130"; // sets the SMTP server
  22. $mail->Port = 25; // set to standard SMTP port
  23. $mail->Username = "idint\noreply"; // SMTP account username
  24. $mail->Password = "K1tti352010!"; // SMTP account password
  25.  
  26. $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
  27. $mail->AddAddress('anthony@thejonesgroup.com', 'John Doe');
  28.  
  29. $mail->SetFrom('noreply@idi.com', 'Sales Offering Memorandum');
  30. $mail->AddReplyTo('noreply@idi.com', 'No Reply');
  31. $mail->Subject = 'Sales Offering Memorandum - ' . $_POST['hidden_name'] . ' - ' . $_POST['hidden-property'];
  32. $mail->MsgHTML($contents);
  33. $mail->Send();
  34. echo "Message Sent OK</p>\n";
  35. } catch (phpmailerException $e) {
  36. echo $e->errorMessage(); //Pretty error messages from PHPMailer
  37. } catch (Exception $e) {
  38. echo $e->getMessage(); //Boring error messages from anything else!
  39. }
Add Comment
Please, Sign In to add comment