Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. assign your message and Subject before $mail->Send();
  2. and close `if` You are missing a '}'
  3.  
  4. if(isset($_POST['submit']))
  5. {
  6.  
  7. $message=
  8. 'Full Name: '.$_POST['name'].'<br/>
  9. Comments: '.$_POST['comments'].'<br/>
  10. Email: '.$_POST['email'].'
  11. ';
  12.  
  13. require 'phpmailer/PHPMailerAutoload.php';
  14.  
  15. $mail = new PHPMailer;
  16.  
  17. //$mail->SMTPDebug = 3; // Enable verbose debug output
  18.  
  19. $mail->isSMTP(); // Set mailer to use SMTP
  20. $mail->Host = 'smtp.mail.yahoo.com'; // Specify main and backup SMTP servers
  21. $mail->SMTPAuth = true; // Enable SMTP authentication
  22. $mail->Username = 'aroncea@yahoo.com'; // SMTP username
  23. $mail->Password = 'letmejusteditthisout'; // SMTP password
  24. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  25. $mail->Port = 465; // TCP port to connect to
  26.  
  27. $mail->setFrom($_POST['email'], $_POST['name']);
  28. $mail->addReplyTo($_POST['email'], $_POST['name']);
  29.  
  30. $mail->addAddress('aroncea@yahoo.com'); // Add a recipient
  31. $result = $mail->Send();
  32. $message = $result ? 'Successfully sent!' : 'Sending Failed!';
  33. unset($mail);
  34.  
  35. $mail->Subject = "New Form Submission";
  36. $mail->MsgHTML($message);
  37. $result = $mail->Send();
  38. $message = $result ? 'Successfully sent!' : 'Sending Failed!';
  39. unset($mail);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement