$staff_details = $ost_wpdb->get_results("SELECT email,firstname,lastname FROM {$ost_staff} WHERE `group_id` ={$group_id}"); foreach ($staff_details as $staff) { $staff_firstname = $staff->firstname; $staff_lastname = $staff->lastname; $staff_email = $staff->email; $subject = $sub; $deptmessage = "Hello {$staff_firstname} {$staff_lastname},<br />A new ticket has been created.<br /><br />"; $deptmessage .= "Ticket ID #" . $ticketid . ""; $deptmessage .= "<br />----------------------<br />"; $deptmessage .= "Name: " . $username . "<br />"; $deptmessage .= "Email: " . $usermail . "<br />"; $deptmessage .= "Priority: " . $priordesc . "<br />"; $deptmessage .= "Department: " . $dept_name . "<br />"; $deptmessage .= "Subject: " . $subject . "<br />"; $deptmessage .= "<br />----------------------<br />"; $deptmessage .= "Message: " . $user_message . ""; $deptmessage .= "<br />----------------------<br /><br />"; $deptmessage .= "To respond to the ticket, please login to the support ticket system."; $deptmessage .= "<br /><br />"; $deptmessage .= "" . site_url() . ""; $deptmessage .= "<br />"; $deptmessage .= "Your friendly Customer Support System "; $headers = 'From: ' . $ostitle . ' <' . $adem . ">\r\n"; add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); wp_mail($staff_email, $subject, key4ce_wpetss_forum_text('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $deptmessage), $headers); } } //If Department User Not Found System Will Send Email To Group Members Of Related Department Added By Pratik Maniar on 16-06-2014 Code End Here } } //Email Notification to Department Of Staff Added by Pratik Maniar on 28-04-2014 End Here
$phpmailer = new PHPMailer(); $phpmailer->SMTPAuth = true; $phpmailer->Username = $smtp_username; $phpmailer->Password = $smtp_password; $phpmailer->isHTML(true); $phpmailer->CharSet = 'UTF-8'; $phpmailer->IsSMTP(true); // telling the class to use SMTP $phpmailer->Host = $smtp_host; // SMTP server $phpmailer->Port = $smtp_port; $phpmailer->From = "{$ticket_detail_dept_email}"; $phpmailer->FromName = "{$ticket_detail_dept_name}"; add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); $phpmailer->Subject = $subject; $phpmailer->Body = key4ce_wpetss_forum_text($message); //HTML Body $phpmailer->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $message); $phpmailer->AddAddress($to); $phpmailer->Send(); } else { $phpmailer->CharSet = 'UTF-8'; $phpmailer->setFrom("{$ticket_detail_dept_email}", "{$ticket_detail_dept_name}"); $phpmailer->addReplyTo("{$ticket_detail_dept_email}", "{$ticket_detail_dept_name}"); $phpmailer->addAddress($to); add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); $phpmailer->Subject = $subject; $phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $message); $phpmailer->AltBody = 'This is a plain-text message body';
$phpmailer->CharSet = 'UTF-8'; $phpmailer->IsSMTP(true); // telling the class to use SMTP $phpmailer->Host = $smtp_host; // SMTP server $phpmailer->Port = $smtp_port; $phpmailer->From = "{$dept_user_name}"; $phpmailer->FromName = "{$dept_user_email}"; add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); $phpmailer->Subject = $user_email_subject; $phpmailer->Body = key4ce_wpetss_forum_text($user_email_template); $phpmailer->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $user_email_template); $phpmailer->AddAddress($to); $phpmailer->Send(); } else { $phpmailer->CharSet = 'UTF-8'; $phpmailer->IsSendmail(); // telling the class to use SendMail transport $phpmailer->AddReplyTo("{$dept_user_email}", "{$dept_user_name}"); $phpmailer->From = "{$dept_user_name}"; $phpmailer->FromName = "{$dept_user_email}"; $phpmailer->AddAddress($to, $usname); add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); $phpmailer->Subject = $user_email_subject; $phpmailer->Body = key4ce_wpetss_forum_text($user_email_template); $phpmailer->AltBody = "To view the message, please use an HTML compatible email viewer!"; $phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $user_email_template); $phpmailer->Send(); }