Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <?php
  2. require_once('class.phpgmailer.php');
  3. $mail = new PHPGMailer();
  4. $mail->Username = 'username@gmail.com';
  5. $mail->Password = '********';
  6. $mail->From = 'username@gmail.com';
  7. $mail->FromName = "<blah>";
  8. $mail->Subject = 'something';
  9. $mail->AddAddress('xyz@gmail.com');
  10.  
  11.  
  12. $mail->Body = "Hello Sir"."n"."
  13. Your Password is : ."."";
  14. $mail->Host = 'smtp.gmail.com';
  15. $mail->Port = 465;
  16. $mail->Send();
  17.  
  18. if(!$mail->Send())
  19. {
  20.  
  21. echo 'Message could not be sent.' ;
  22. echo 'Mailer Error: ' . $mail->ErrorInfo;
  23.  
  24. exit;
  25. }
  26. echo 'Message has been sent';
  27.  
  28. require("phpmailer/class.phpmailer.php");
  29.  
  30. $mail = new PHPMailer();
  31. $mail->IsSMTP();
  32. $mail->SMTPAuth = true;
  33. $mail->Host = "ssl://smtp.gmail.com";
  34. $mail->Port = 465;
  35. $mail->Username = "from@gmail.com";
  36. $mail->Password = "****";
  37. $mail->FromName = "Sender name";
  38. $mail->Subject = "test";
  39. $mail->Body = "Test body";
  40. $mail->AddAddress('sender@mail.com');
  41. if(!$mail->Send()){
  42. echo "Mailer Error: " . $mail->ErrorInfo;
  43. }else{
  44. echo "Message has been sent";
  45. }
  46.  
  47. $mail->IsSMTP(); // enable SMTP
  48. $mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
  49. $mail->SMTPAuth = true; // authentication enabled
  50. $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
  51. $mail->Host = 'smtp.gmail.com';
  52. $mail->Port = 465;
  53. $mail->Username = 'email@gmail.com';
  54. $mail->Password = 'password';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement