Guest User

Untitled

a guest
Jan 15th, 2019
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?
  2. if(!empty($_POST['sender_mail'])
  3. || !empty($_POST['sender_name'])
  4. || !empty($_POST['sender_surname'])
  5. || !empty($_POST['sender_major'])
  6. || !empty($_POST['sender_schoolyear'])
  7. || !empty($_POST['sender_id']))
  8. {
  9. phpinfo();
  10. require_once('class.phpmailer.php');
  11. include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
  12. $smail = $_POST['sender_mail'];
  13. $name = $_POST['sender_name'];
  14. $surname = $_POST['sender_surname'];
  15. $major = $_POST['sender_major'];
  16. $schoolyear = $_POST['sender_schoolyear'];
  17. $id = $_POST['sender_id'];
  18.  
  19. $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
  20.  
  21. $mail->IsSMTP(); // telli ng the class to use SMTP
  22.  
  23. try { // Here is 23th line
  24. $mail->SMTPAuth = true; // enable SMTP authentication
  25. $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
  26. $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
  27. $mail->Port = 465; // set the SMTP port for the GMAIL server
  28. $mail->Username = "xxxxx@gmail.com"; // GMAIL username
  29. $mail->Password = "xxxxxxx"; // GMAIL password
  30. $mail->AddAddress('xxxxx@gmail.com', 'Membership');
  31. $mail->SetFrom('xxxxx@gmail.com', 'GGK');
  32. $mail->Subject = 'New Membership';
  33. $mail->IsHTML(true);
  34. $mail->Body = '<h3>New Membership</h3><br/><i><b>Name: </i></b><i>' . $name . '</i><br/><b><i>Surname: </i></b><i>' . $surname . '</i><br/><b><i>Mail: </i></b><i>' . $smail . '</i><br/><b><i>ID: </i></b><i>' . $id . '</i><br/><b><i>Schoolyear: </b></i><i>' . $schoolyear . '</i><br/><b><i>Major: </b></i><i>' . $major . '</i>';
  35. $mail->Send();
  36. echo "Message Sent OK</p>n";
  37. } catch (phpmailerException $e) {
  38. echo -1;
  39. echo $e->errorMessage(); //Pretty error messages from PHPMailer
  40. } catch (Exception $e) {
  41. echo -1;
  42. echo $e->getMessage(); //Boring error messages from anything else!
  43. }
  44. }
  45. else{
  46. echo -1;
  47. }
  48. ?>
Add Comment
Please, Sign In to add comment