Advertisement
Guest User

Untitled

a guest
May 17th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1.         include_once(serverpath."includes/functions/phpmailer/class.phpmailer.php");
  2.         include_once(serverpath."includes/functions/phpmailer/class.smtp.php");
  3.         $mail = new PHPMailer();   
  4.         $mail->PluginDir = serverpath.'includes/functions/phpmailer/';
  5.         $mail->SetLanguage( 'es', ''.serverpath.'includes/functions/phpmailer/language/' );
  6.         $mail->CharSet  = "UTF-8";
  7.         $mail->From     = $from;
  8.         $mail->FromName = $from_name;
  9.         $mail->AddAddress($to);
  10.         $mail->Subject  = $subject;
  11.         $mail->Body = $message;    
  12.         $mail -> IsHTML (true);    
  13.        
  14.         if (!empty($attachment))
  15.         {
  16.             foreach ($attachment as $value)
  17.             $mail->AddAttachment($value);
  18.         }
  19.            
  20.         if ($type==0) //SMTP
  21.         {
  22.         $mail->IsSMTP();
  23.         $mail->Mailer="smtp";
  24.         $mail->SMTPAuth = "1";
  25.         $mail->Username = $smtp_user;
  26.         $mail->Password = $smtp_pass;
  27.         $mail->Host     = $smtp_host;  
  28.         }
  29.         elseif ($type==1) //Funcion mail
  30.         {
  31.             $mail->IsMail();
  32.             $mail->Mailer="mail";
  33.            
  34.         }      
  35.         if ($mail->Send()) return true;
  36.         else {
  37.             echo $mail->ErrorInfo;
  38.             return false;          
  39.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement