Location: PHPKode > projects > MembersGear > membersgear/includes/phpmailer/Functions.php
<?php   
  function sendMail($toAdd,$toName="",$subject,$body="",$altbody="",$IsOnline=false)
  {
        require_once("class.phpmailer.php");
        $mail = new PHPMailer();
         
        //if($IsOnline==true)
         //   $mail->IsSendmail();
        //else
        if(SEND_EMAIL_METHOD=='smtp')
             $mail->IsSMTP();  
        else if(SEND_EMAIL_METHOD=='sendmail') 
            $mail->IsSendmail();
                                               // set mailer to use SMTP
        /* Online*/ 
        //$mail->IsSendmail();
/*            
        $mail->Host = "smtp.gmail.com";
        $mail->SMTPAuth = true;     // turn on SMTP authentication
        $mail->Username = "hide@address.com";  // SMTP username
        $mail->Password = "F3nc3R3f3r33"; // SMTP password
        $mail->Port=587;
        $mail->From = "hide@address.com";
        $mail->FromName = "Fence Your Referee";
*/
       /* $mail->Host = "192.168.99.5";
        $mail->SMTPAuth = false;     // turn on SMTP authentication
        $mail->Username = "abpanchal";  // SMTP username
        $mail->Password = "abpanchal"; // SMTP password
        $mail->Port=25;*/
         $mail->Host      =  PHPMAILER_HOST;
         $mail->SMTPAuth  =  (PHPMAILER_SMTPAUTH==false)?false:true;
         $mail->Username  =  PHPMAILER_USERNAME;
         $mail->Password  =  PHPMAILER_PASSWORD;
         $mail->Port      =  PHPMAILER_PORT;  
         
        
       // $mail->From = "hide@address.com";
        $mail->From = PHPMAILER_EMAIL_FROM;
        //$mail->FromName=''
       // $mail->FromName = "membersite";        
         $mail->FromName = PHPMAILER_EMAIL_FROM_NAME;       
        
        $mail->AddAddress($toAdd,$toName);
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        $mail->IsHTML(true); // send as HTML
        $mail->Subject = stripslashes(trim($subject));
        $body =stripslashes(trim($body));
        $mail->Body=$body;
        $mail->AltBody =  $altbody;
        if(!$mail->Send())
        {

             //echo $mail->ErrorInfo;
             return false;
        }
        else
        {
            //echo $mail->ErrorInfo;
            return true;
        }
   }
   
   function sendCannedEmailsToAdmin($pMailFor)
   {
        require_once("class.phpmailer.php");
        $mail = new PHPMailer();
        
        if(SEND_EMAIL_METHOD=='smtp')
             $mail->IsSMTP();  
        else if(SEND_EMAIL_METHOD=='sendmail') 
            $mail->IsSendmail();
        
        $mail->Host      =  PHPMAILER_HOST;
        $mail->SMTPAuth  =  (PHPMAILER_SMTPAUTH==false)?false:true;
        $mail->Username  =  PHPMAILER_USERNAME;
        $mail->Password  =  PHPMAILER_PASSWORD;
        $mail->Port      =  PHPMAILER_PORT;
        
        
        $mail->From = $pMailFor[0]['sender_email'];
        //$mail->FromName=''
        $mail->FromName = $pMailFor[0]['sender_name'];        
        
        $mail->AddAddress(ADMINISTRATOR_EMAIL_ADDRESS,'');
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        
        if($pMailFor[0]['admin_email_format'] == 'HTML' || $pMailFor[0]['admin_email_format'] == ' ')
        {
            $mail->IsHTML(true);
        }
        elseif($pMailFor[0]['admin_email_format'] == 'Text')
        {
            $mail->IsHTML(false); // send as HTML
        }
         
        $mail->Subject = stripslashes(trim($pMailFor[0]['admin_email_subject']));
        $body =stripslashes(trim($pMailFor[0]['admin_email_message']));
        $mail->Body=$body;
        $mail->AltBody =  "";
        if($pMailFor[0]['email_attachment']!=null)
        {
            $mail->AddAttachment($pMailFor[0]['email_attachment']); 
        }
        if(!$mail->Send())
        {

             //echo  $mail->ErrorInfo;
             return false;
        }
        else
        {
            //echo $mail->ErrorInfo;
            return true;
        }
   }
   
   function sendCannedEmailsToUsers($pEmailAddress,$pMailFor)
   {
        require_once("class.phpmailer.php");
        
        $mail = new PHPMailer();
        
         if(SEND_EMAIL_METHOD=='smtp')
             $mail->IsSMTP();  
        else if(SEND_EMAIL_METHOD=='sendmail') 
             $mail->IsSendmail();  
        /* Online*/ 
        //$mail->IsSendmail();
        
        $mail->Host      =  PHPMAILER_HOST;
        $mail->SMTPAuth  =  (PHPMAILER_SMTPAUTH==false)?false:true;
        $mail->Username  =  PHPMAILER_USERNAME;
        $mail->Password  =  PHPMAILER_PASSWORD;
        $mail->Port      =  PHPMAILER_PORT;
        
        
        $mail->From = $pMailFor[0]['sender_email'];
        //$mail->FromName=''
        $mail->FromName = $pMailFor[0]['sender_name'];
        $mail->AddReplyTo(ADMINISTRATOR_EMAIL_ADDRESS,'Administrator');
        
        $mail->AddAddress($pEmailAddress,'');
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        
        if($pMailFor[0]['email_format'] == 'HTML' || $pMailFor[0]['email_format'] == ' ')
        {
            $mail->IsHTML(true);
        }
        elseif($pMailFor[0]['email_format'] == 'Text')
        {
            $mail->IsHTML(false); // send as HTML
        }
           
        $mail->Subject = stripslashes(trim($pMailFor[0]['email_subject']));
        
        if($pMailFor[0]['email_copy_to'] != '')
        {
               $lsSplitEmailList = explode(",",$pMailFor[0]['email_copy_to']);
               foreach($lsSplitEmailList as $lsEmailValue)
               {
                     $mail->AddCC($lsEmailValue,'');
               }
        
        }
        
        $body =stripslashes(trim($pMailFor[0]['email_message']));
        $mail->Body=$body;
        $mail->AltBody =  "";
        if($pMailFor[0]['email_attachment']!=null)
        {
            $mail->AddAttachment($pMailFor[0]['email_attachment']);
        }
        if(!$mail->Send())
        {

             //echo  $mail->ErrorInfo;
             return false;
        }
        else
        {
            //echo $mail->ErrorInfo;
            return true;
        }  
         
   }

   function sendSupportMail($fromAdd,$fromName="",$subject,$body="",$altbody="",$IsOnline=false)
  {
        require_once("class.phpmailer.php");
        $mail = new PHPMailer();
        
         if(SEND_EMAIL_METHOD=='smtp')
             $mail->IsSMTP();  
        else if(SEND_EMAIL_METHOD=='sendmail') 
          $mail->IsSendmail();                                 // set mailer to use SMTP

         $mail->Host      =  PHPMAILER_HOST;
         $mail->SMTPAuth  =  (PHPMAILER_SMTPAUTH==false)?false:true;
         $mail->Username  =  PHPMAILER_USERNAME;
         $mail->Password  =  PHPMAILER_PASSWORD;
         $mail->Port      =  PHPMAILER_PORT;  
         
        
        $mail->From = $fromAdd;
        //$mail->FromName=''
        $mail->FromName = $fromName;        
        $mail->AddReplyTo($fromAdd,$fromName);
        
        $mail->AddAddress(ADMINISTRATOR_EMAIL_ADDRESS,'Administrator');
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        $mail->IsHTML(true); // send as HTML
        $mail->Subject = stripslashes(trim($subject));
        $body =stripslashes(trim($body));
        $mail->Body=$body;
        $mail->AltBody =  $altbody;
        
        if(!$mail->Send())
        {

             //echo  $mail->ErrorInfo;
             return false;
        }
        else
        {
            //echo $mail->ErrorInfo;
            return true;
        }
   }
   
    function sendInstallationMail($fromAdd,$fromName="",$subject,$host,$isauthsmtp,$method,$username,$password,$port,$body="",$altbody="",$IsOnline=false )
  {
        require_once("class.phpmailer.php");
        $mail = new PHPMailer();
        
         if($method=='smtp')
             $mail->IsSMTP();  
        else if($method=='sendmail') 
          $mail->IsSendmail();                                 // set mailer to use SMTP

         $mail->Host      =  $host;
         $mail->SMTPAuth  =  ($isauthsmtp==false)?false:true;
         $mail->Username  =  $username;
         $mail->Password  =  $password;
         $mail->Port      =  $port;  
         
        
        $mail->From = $fromAdd;
        //$mail->FromName=''
        $mail->FromName = $fromName;        
        $mail->AddReplyTo($fromAdd,$fromName);
        
        $mail->AddAddress($fromAdd,'Administrator');
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        $mail->IsHTML(true); // send as HTML
        $mail->Subject = stripslashes(trim($subject));
        $body =stripslashes(trim($body));
        $mail->Body=$body;
        $mail->AltBody =  $altbody;
        
        if(!$mail->Send())
        {

             //echo  $mail->ErrorInfo;
             return false;
        }
        else
        {
            //echo $mail->ErrorInfo;
            return true;
        }
   }
   
   
     function sendTestMail($fromAdd,$fromName="",$adminemail,$subject,$host,$isauthsmtp,$method,$username,$password,$port,$body="",$altbody="",$IsOnline=false )
  {
        require_once("class.phpmailer.php");
        $mail = new PHPMailer();
        
         if($method=='smtp')
             $mail->IsSMTP();  
        else if($method=='sendmail') 
          $mail->IsSendmail();                                 // set mailer to use SMTP

         $mail->Host      =  $host;
         $mail->SMTPAuth  =  ($isauthsmtp==false)?false:true;
         $mail->Username  =  $username;
         $mail->Password  =  $password;
         $mail->Port      =  $port;  
         
        
        $mail->From = $fromAdd;
        //$mail->FromName=''
        $mail->FromName = $fromName;        
        $mail->AddReplyTo($fromAdd,$fromName);
        
        $mail->AddAddress($adminemail,'Administrator');      
        $mail->WordWrap = 50;                                 // set word wrap to 50 characters
        $mail->IsHTML(true); // send as HTML
        $mail->Subject = stripslashes(trim($subject));
        $body =stripslashes(trim($body));
        $mail->Body=$body;
        $mail->AltBody =  $altbody;
        
        if(!$mail->Send())
        {

             //echo  $mail->ErrorInfo;
             return false;
        }
        else
        {
            //echo $mail->ErrorInfo;
            return true;
        }
   }
   
?>
Return current item: MembersGear