Guest User

Untitled

a guest
Dec 4th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. ?php
  2. if( isset($_POST["submit"]) ) {
  3. //include PHPMailerAutoload.php
  4. require 'phpmailer/PHPMailerAutoload.php';
  5.  
  6. //create an instance of PHPMailer
  7. $mail = new PHPMailer();
  8.  
  9. //set a host
  10. $mail->Host = "smtp.gmail.com";
  11.  
  12. //enable SMTP
  13. //$mail->isSMTP();
  14. //$mail->SMTPDebug = 2;
  15.  
  16. //set authentication to true
  17. $mail->SMTPAuth = true;
  18.  
  19. //set login details for Gmail account
  20. $mail->Username = "***@gmail.com";
  21. $mail->Password = "***";
  22.  
  23. //set type of protection
  24. $mail->SMTPSecure = "ssl"; //or we can use TLS
  25.  
  26. //set a port
  27. $mail->Port = 465; //or 587 if TLS
  28.  
  29. //set subject
  30. $mail->Subject = "test email";
  31.  
  32. //set HTML to true
  33. //$mail->isHTML(true);
  34.  
  35. //set body
  36. $mail->Body = "Body of message";
  37.  
  38. //set who is sending an email
  39. $mail->setFrom('***', 'startet zina');
  40.  
  41. //set where we are sending email (recipients)
  42. $mail->addAddress('***@gmail.com');
  43. $mail->addAddress('***@inbox.lv');
  44.  
  45. //send an email
  46. if ($mail->send())
  47. echo "mail is sent";
  48. else
  49. echo $mail->ErrorInfo;
  50.  
  51. } ?>
Add Comment
Please, Sign In to add comment