Advertisement
Guest User

Untitled

a guest
Apr 12th, 2017
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?php
  2. $sendfrm_name = 'Balakumar B';
  3. $sendfrm_id = 'sghish@gmail.com';
  4.  
  5. $sendtoname = 'Receiver G';
  6. $sendto = 'receiver@receiverdomain.com';
  7.  
  8. //$cc = '';
  9.  
  10. include("mail/PHPMailerAutoload.php");
  11. include("mail/class.PHPMailer.php");
  12. include("mail/class.smtp.php");
  13.  
  14. $mail = new PHPMailer;
  15. //$mail-> isSMTP();
  16. $mail-> Host = 'mail.mydomain.com'; //smtp.gmail.com
  17. $mail->SMTPDebug = 2;
  18. $mail-> SMTPAuth = true;
  19. $mail->smtpConnect = array(
  20. 'ssl' => array(
  21. 'verify_peer' => false,
  22. 'verify_peer_name' => false,
  23. 'allow_self_signed' => true
  24. )
  25. );
  26. $mail-> Username = 'balakumar@mydomain.com';
  27. $mail-> Password = 'balakumar1`2345';
  28. $mail-> SMTPSecure = 'tls';
  29. $mail-> Port = 465; //587
  30. $mail-> setFrom($sendfrm_id, $sendfrm_name);
  31. $mail-> addAddress($sendto, $sendtoname);
  32. $mail-> addReplyTo($sendto, $sendtoname);
  33. //$mail->addCC($cc);
  34. $mail->WordWrap = 50;
  35. $mail->isHTML(true);
  36. $mail->Subject = "Test Mail";
  37. $mail->Body = "Name: ".$sendfrm_name ."<br /> Email: ".$sendfrm_id;
  38. if(!$mail->send())
  39. {
  40. echo "Mailer Error: ".$mail->ErrorInfo;
  41. }
  42. else
  43. {
  44. echo echo("<p>Message successfully sent!</p>");
  45. echo "E-mail: ", $sendto, "<br />";
  46. echo "Name: ", $sendtoname, "<br />";
  47. echo "Subject: Test Mail<br />";
  48. echo "Body: Body Of the Mail<br />";
  49.  
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement