How can I send a message directly to the good file (header)

Moderator: crythias

Locked
dadub
Znuny newbie
Posts: 3
Joined: 24 Mar 2014, 20:23
Znuny Version: 3.3.5

How can I send a message directly to the good file (header)

Post by dadub »

Hi,

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}
Exemple

Code: Select all

X-OTRS-Queue: ULB::Support-ULB::PaDi::FSP
I don't know where in my code (see below) I have to put this header ?

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>";
    }
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: How can I send a message directly to the good file (head

Post by jojo »

You should hire someone with some more experience in coding....
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
dadub
Znuny newbie
Posts: 3
Joined: 24 Mar 2014, 20:23
Znuny Version: 3.3.5

Re: How can I send a message directly to the good file (head

Post by dadub »

jojo wrote:You should hire someone with some more experience in coding....
Hi,

Thank you for your reply.

Am I in the right forum ?

David
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: How can I send a message directly to the good file (head

Post by jojo »

No, a developer forum for the language you are coding in would be much better for your question
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: How can I send a message directly to the good file (head

Post by reneeb »

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";

    // set OTRS headers
    $headers .= "\nX-OTRS-Queue: ${Queuename}";

    // 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}\"";
[...]
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
dadub
Znuny newbie
Posts: 3
Joined: 24 Mar 2014, 20:23
Znuny Version: 3.3.5

Re: How can I send a message directly to the good file (head

Post by dadub »

Thank you very much Reneeb.

David
Locked