Advertisement
Guest User

Untitled

a guest
Jun 15th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2. require_once("C:\\xampp\\phpMailer\\PHPMailer-master\\class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5. $mail->IsSMTP();  // telling the class to use SMTP
  6. $mail->SMTPAuth = true;         // Enable SMTP authentication
  7. $mail->SMTPSecure = 'ssl' ;
  8. $mail->Host    = "smtp.gmail.com" ;// SMTP server
  9. $mail->Port = 465; // or 587   <br/>
  10.  
  11. $mail->Username = 'senderemailid@gmail.com';    // SMTP username
  12. $mail->Password = 'senderpassword';     // SMTP password  
  13.  
  14. $mail -> IsHTML(true);
  15. $mail->From    = 'senderemailid@gmail.com';
  16. $mail->FromName = 'sendername';
  17. $mail->addAddress('receiveremailid@domain.com','receivername');
  18.  
  19. $mail->WordWrap = 50;
  20.  
  21. $mail->Subject  = "This mail send from  PhP code xampp";
  22. $mail->Body     = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
  23.  
  24. if(!$mail->Send()) {  
  25. echo 'Message was not sent.';  
  26. echo 'Mailer error: ' . $mail->ErrorInfo;
  27.  
  28. } else
  29.  {
  30. echo 'Message has been sent.';
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement