CC Email in osTicket v1.6 RC5

There are several questions in osTicket Discussion Forum that asking about CC Email in osTicket. If you want to implement CC (Carbon Copy) Email in osTicket v1.6 RC5, you may apply the modification I made. I modified the class.email.php file that located in \include\ sub directory of osTicket System.

  1. Open your \include\class.email.php file, and find this code:

    135
    
        function send($to,$subject,$message,$attachment=null) {

    then replace with this following code:

    135
    
        function send($to,$subject,$message,$attachment=null,$cc='') {

    Find again this code:

    161
    162
    163
    164
    165
    166
    167
    
            $headers = array ('From' => $from,
                              'To' => $to,
                              'Subject' => $subject,
                              'Message-ID' =>'<'.Misc::randCode(6).''.time().'-'.$this->getEmail().'>',
                              'X-Mailer' =>'osTicket v 1.6',
                              'Content-Type' => 'text/html; charset="UTF-8"'
                              );

    then replace with this following code:

    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    
            if ($cc!='') {
              $headers = array ('From' => $from,
                              'To' => $to,
                              'Subject' => $subject,
                              'Cc' => $cc,
                              'Message-ID' =>'<'.Misc::randCode(6).''.time().'-'.$this->getEmail().'>',
                              'X-Mailer' =>'osTicket v 1.6',
                              'Content-Type' => 'text/html; charset="UTF-8"'
                              );
            } else {
              $headers = array ('From' => $from,
                              'To' => $to,
                              'Subject' => $subject,
                              'Message-ID' =>'<'.Misc::randCode(6).''.time().'-'.$this->getEmail().'>',
                              'X-Mailer' =>'osTicket v 1.6',
                              'Content-Type' => 'text/html; charset="UTF-8"'
                              );					
    	}
  2. Now, if you want to add a CC Email when calling that send function belongs to class.email.php, then you may use the following code, for example:

    $email->send($email_to,$subject,$body,null,$email_cc); // without attachment

    which $email_cc is a variable that contains of the valid email that you want to CC it.

Hopefully this will help you.

Share

3,776 viewsPrint This Post Print This Post

Comments

  1. bhupal says:

    hai this is not working can you please help me when this replying to ticket by staff

  2. Thanks for the feedback. I will re-check the code.

  3. Durga says:

    issue for me.

    behavior is…
    TO guy receives email, CC will not get email.
    but in received email (in TO guy inbox) it is showing the CC email in the email. we have verified the email address and it is correct.

  4. $email->send($email_to,$subject,$body,null,$email_cc); // without attachment
    Where we need to use this code

    Thank you

  5. Melissa says:

    How can you add a BCC?

  6. kavlito says:

    I don’t understand this – where is this code supposed to go?

    2. Now, if you want to add a CC Email when calling that send function belongs to class.email.php, then you may use the following code, for example:

    $email->send($email_to,$subject,$body,null,$email_cc); // without attachment

    which $email_cc is a variable that contains of the valid email that you want to CC it.

Speak Your Mind

*


*