Advertisement
Guest User

Untitled

a guest
Sep 14th, 2015
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. phpMail("to@example.com", $subject, $body, "from@example.com", "replyto@example.com");
  2.  
  3. $mail = new PHPMailer;
  4.  
  5. //$mail->SMTPDebug = 3; // Enable verbose debug output
  6.  
  7. $mail->isSMTP(); // Set mailer to use SMTP
  8. $mail->Host = 'smtp.zoho.com'; // Specify main and backup SMTP servers
  9. $mail->SMTPAuth = true; // Enable SMTP authentication
  10. $mail->Username = '**REMOVED**'; // SMTP username
  11. $mail->Password = '**REMOVED**'; // SMTP password
  12. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  13. $mail->Port = 465; // TCP port to connect to
  14.  
  15. $mail->isHTML(true); // Set email format to HTML
  16.  
  17.  
  18. // SYTAX: phpMail($from, $reply, $to, $subject, $body);
  19. function phpMail($to, $subject, $body, $from = "from@example.com", $reply = "replyto@example.com") {
  20. if (isset($from))
  21. $mail->From = $from;
  22. $mail->FromName = "testing";
  23.  
  24. if (isset($to))
  25. $mail->addAddress($to);
  26.  
  27. if (isset($reply))
  28. $mail->addReplyTo($reply);
  29.  
  30. if (isset($subject))
  31. $mail->Subject = $subject;
  32.  
  33. if (isset($body))
  34. $mail->Body = $body;
  35. $mail->AltBody = $body;
  36.  
  37. if(!$mail->send()) {
  38. echo 'Message could not be sent.';
  39. echo 'Mailer Error: ' . $mail->ErrorInfo;
  40. } else {
  41. echo 'Message has been sent';
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement