I would like to send message to good otrs file.
I have to add a header like this :
Code: Select all
X-OTRS-Queue: ${Queuename}
Code: Select all
X-OTRS-Queue: ULB::Support-ULB::PaDi::FSP
Thank you in advance for your help.
David
Code: Select all
// email fields: to, from, subject, and so on
$to = "padi@...be";
$subject ="My subject";
$from = $_POST['netID']."@...be <".$_POST['netID']."@....be>";
$headers = "From: $from";
// boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
// multipart boundary
$message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
$message .= "--{$mime_boundary}\n";
if(isset($_SESSION['$path']))
{
// preparing attachments
$file = fopen($path,"rb");
$data = fread($file,filesize($path));
fclose($file);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$path\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$path\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
$message .= "--{$mime_boundary}\n";
}
// send
$ok = @mail($to, $_POST['campus']." ".$_POST['faculte']." ".$_POST['local']." ".$_POST['type_probleme'], $message, $headers);
unset($_SESSION['$path']);
//print_r($_SESSION);
if ($ok)
{
echo "<p>mail sent to $to!</p>";
}
else
{
echo "<p>mail could not be sent!</p>";
}