Guest User

util

a guest
Apr 13th, 2019
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1.  
  2. <?php
  3.     require_once('PHPMailer/class.phpmailer.php');
  4.     class Util{
  5.         public static function sendMail($to,$subject, $body){
  6.             $mail = new PHPMailer();
  7.             $mail->IsSMTP();
  8.             $mail->SMTPAuth = true;
  9.             $mail->SMTPSecure = 'ssl';
  10.             $mail->Host = "smtp.gmail.com";
  11.             $mail->Port = 465; // or 587
  12.             $mail->IsHTML(true);
  13.             $mail->Username = "the.rolling.cat.it@gmail.com";
  14.             $mail->Password = "15422176";
  15.             $mail->AddAddress("the.rolling.cat.it@gmail.com");
  16.             $mail -> AddReplyTo($to);
  17.             $mail->Subject = $subject;    
  18.             $mail->Body = $body;
  19.             return $mail->Send();
  20.         }
  21.         /**
  22.          * ritorna la stringa argomento in minuscolo econ gli spazi sostituiti da "-".
  23.          */
  24.         public static function customAttributeEncoder($attr) {
  25.           return strtolower(str_replace(" ", "-", $attr));
  26.         }
  27.         /**
  28.          * ritorna la stringa argomento in minuscolo e con gli spazi sostituiti da "_".
  29.          */
  30.         public static function customLinkEncoder($link) {
  31.           return strtolower(str_replace(" ", "_", $link));
  32.         }
  33.     }
  34.     //funzione statica che manda la mail
  35. ?>
Add Comment
Please, Sign In to add comment