Advertisement
Alex_Trubchaninov

SMTP server via PHPMailer

Jun 29th, 2016
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <?php
  2. require("/home/c/cm13906/public_html/testingphpmailer/PHPMailer_5.2.0/class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5.  
  6. $mail->IsSMTP();                                      // set mailer to use SMTP
  7. $mail->Host = "smtp.timeweb.ru";  // specify main and backup server
  8. $mail->SMTPAuth = "true";     // turn on SMTP authentication
  9. $mail->SMTPSecure = "tls";
  10. $mail->Port = "25";
  11. $mail->Username = "send@cm13906.tmweb.ru";  // SMTP username
  12. $mail->Password = "Thisisafakepassword"; // SMTP password
  13.  
  14. $mail->From = "send@cm13906.tmweb.ru";
  15. $mail->FromName = "Alexey Trubchaninov";
  16.  
  17. $mail->AddAddress("recieve@cm13906.tmweb.ru");                  // name is optional
  18.  
  19.  
  20. $mail->WordWrap = 50;                                 // set word wrap to 50 characters
  21. $mail->IsHTML(true);                                  // set email format to HTML
  22.  
  23. $mail->Subject = "Delivery Request";
  24. $mail->Body    = "Hello, this is a test";
  25. $mail->AltBody = "Test";
  26.  
  27. if(!$mail->Send())
  28. {
  29.    echo "Message could not be sent. <p>";
  30.    echo "Mailer Error: " . $mail->ErrorInfo;
  31.    exit;
  32. }
  33.  
  34. echo "Message has been sent";
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement