public function sendMail($id) { $reply = Ticketreply::find_by_id($id); $ticket = Ticket::find_by_id($reply->ticket_id); $ccemails = Ccemail::find_by_ticket($reply->ticket_id); $client = Client::find_by_id($_SESSION['client_ident']); $to = '*****@*****.**'; $t = '*****@*****.**'; $cc = ""; $subject = 'Ticket Number: #' . str_pad($ticket->id, 8, "0", STR_PAD_LEFT) . " " . $ticket->subject; $headers = "From: " . $client->name . "<" . $client->email . ">\r\n"; $headers .= "Reply-To: " . $ticket->contact_email . "\r\n"; if ($ccemails) { $copyaddy = array(); foreach ($ccemails as $ccemail) { array_push($copyaddy, $ccemail->email); } for ($i = 0; $i < count($copyaddy); $i++) { $cc .= "," . $copyaddy[$i]; } $t .= $cc; } $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Cc: " . $t . "\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n"; /* $smtp = \Mail::factory('smtp', array( 'host' => 'ssl://n1plcpnl0021.prod.ams1.secureserver.net', 'port' => '465', 'auth' => true, 'username' => '*****@*****.**', 'password' => 'rjsupport2015' ));*/ $message = ' <html><body> <h1>Robert Johnson Holdings Limited</h1> <h2>Ticket Number #' . str_pad($ticket->id, 8, "0", STR_PAD_LEFT) . '</h2> <table width="100%" border="0"> <tr> <th scope="row" width="30%">Client</th> <td width="70%">' . $reply->sender_name . '</td> </tr> <tr> <th scope="row">Contact Person</th> <td>' . $ticket->contact_name . '</td> </tr> <tr> <th scope="row">Contact Phone Number</th> <td>' . $ticket->contact_phone . '</td> </tr> <tr> <th scope="row">Contact Email</th> <td>' . $ticket->contact_email . '</td> </tr>'; if ($ccemails) { $message .= '<tr> <th scope="row">Copied Emails</th> <td>' . $t . '</td> </tr> <tr>'; } $message .= '<th scope="row">Department</th> <td>' . $ticket->department . '</td> </tr> <tr> <th scope="row">Ticket Status</th> <td>' . $ticket->status . '</td> </tr> <tr> <th scope="row">Priority Level</th> <td>' . $ticket->priority . '</td> </tr> <tr> <th scope="row">Related Product/Service</th> <td>' . $ticket->terminal_id . ' at ' . $ticket->location . '</td> </tr> <tr> <th scope="row">Subject</th> <td>' . $ticket->subject . '</td> </tr> <tr> <th scope="row">Issue/Complaint/Suggestion</th> <td>' . $ticket->issue . '</td> </tr> </table> </body></html>'; if (mail($to, $subject, $message, $headers)) { return true; } else { return false; } /* $mail = $smtp->send($to, $headers, $message); if (PEAR::isError($mail)) { echo('<p>' . $mail->getMessage() . '</p>'); echo "error"; return true; } else { echo "success"; return false; }*/ //lse return false; }