Advertisement
Guest User

Untitled

a guest
Nov 20th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. <?php
  2. require_once('/class.phpmailer.php');
  3. require_once('/class.pop3.php'); // required for POP before SMTP
  4.  
  5. $pop = new POP3();
  6. $pop->Authorise('pop3.yahoo.com',465,10, 'arsalansherwani@yahoo.com',
  7. '******',1);
  8.  
  9. $mail = new PHPMailer();
  10. $msg='Name';
  11. //$body = file_get_contents('contents.html');
  12. //$body = eregi_replace("[]",'',$body);
  13. $address='arsalanjawed619.com';
  14. $mail->IsSMTP();
  15. $mail->SMTPDebug = 1;
  16. $mail->Host = 'pop3.yahoo.com';
  17.  
  18. $mail->SetFrom('arsalansherwani@yahoo.com', 'arsalan');
  19.  
  20. $mail->AddReplyTo("arsalansherwani@yahoo.com","arsalan");
  21.  
  22. $mail->Subject = "PHPMailer Test Subject via POP before SMTP, basic";
  23.  
  24. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
  25.  
  26. $mail->MsgHTML($msg);
  27.  
  28. $address = "arsalanjawed619@yahoo.com";
  29. $mail->AddAddress($address, "arsalan");
  30.  
  31. //$mail->AddAttachment("images/phpmailer.gif"); // attachment
  32. //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
  33.  
  34.  
  35. if(!$mail->Send()) {
  36. echo "Mailer Error: " . $mail->ErrorInfo;
  37. } else {
  38. echo "Message sent!";
  39. }
  40. ?>
  41.  
  42. $pop->Authorise('smtp.mail.yahoo.com',465,10, 'arsalansherwani@yahoo.com',
  43. '******',1);
  44.  
  45. <?php
  46. require_once('class.phpmailer.php');/*Including classes from php mailer*/
  47. require_once('class.pop3.php');
  48. require_once('class.smtp.php');
  49. $pop = new POP3(); /*Create a new object for pop3*/
  50. $pop->Authorise('mailserver001.mydomain.com', 110, 30, 'username', 'password', 1); /*login in to pop3 */
  51. $mail = new PHPMailer();
  52. $mail->IsSMTP();
  53. $mail->Debugoutput = 'html';
  54. $mail->SMTPDebug = 2;
  55. $mail->SMTPOptions = array(
  56. 'ssl' => array(
  57. 'verify_peer' => false,
  58. 'verify_peer_name' => false,
  59. 'allow_self_signed' => true)
  60. ); /*Skip SSL Errors(if any),generally not needed*/
  61. $mail->Host = 'mailserver001.mydomain.com'; /*SMTP host*/
  62. $mail->SetFrom('info@mydomain.com', 'Name');/*Email content */
  63. $mail->AddReplyTo("info@mydomain.com","Name");
  64. $mail->Subject = "Welcome";
  65. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
  66. $mail->MsgHTML('HTML');
  67. $address = "myname@otherdomain.com";
  68. $mail->AddAddress($address, "Name");
  69. if(!$mail->Send()) {/*Send Email*/
  70. echo "Mailer Error: " . $mail->ErrorInfo;
  71. } else {
  72. echo "Message sent!";
  73. }
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement