Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Sign In

Login to our social questions & Answers Engine to ask questions answer people's questions & connect with other people.

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

You must login to add post.

sending eMail via OTRS RPC.PL – (SOAP and PHP)

function create_ticket($mail_sub,$mail_to,$mail_from,$otrs_ticket_nr,$mail_body,$mail_disposition,$src) {
$url = “http://FQDN/otrs/rpc.pl”;
$username = “REPLACE_USER”;
$password = “REPLACE_PWD”;
$title = $mail_sub;
$from = $mail_from;
$email1 = $mail_to;
$body = $mail_body;
$mail_disposition = $mail_disposition;
global $num;
global $name;
echo $name.”-“.$num;
# Set up a new SOAP connection:
$client = new SoapClient(null, array(
‘location’ => $url,
‘uri’ => “Core”,
‘trace’ => 1,
‘login’ => $username,
‘password’ => $password,
‘style’ => SOAP_RPC,
‘use’ => SOAP_ENCODED)
);

# Create a new ticket. The function returns the Ticket ID.

# var_dump($client->__getFunctions());
if(empty($otrs_ticket_nr)) {

# creating a ticket number

$ticketnr = $client->__soapCall(“Dispatch”,
array($username, $password, “TicketObject”, “TicketCreateNumber”));
if(! is_string($ticketnr) )
echo $ticketnr = number_format($ticketnr,0, ‘.’, ”);

$TicketID= $client->__soapCall(“Dispatch”,
array($username, $password,
“TicketObject”, “TicketCreate”,
“TN”, $ticketnr,
“Title”, $title,
“Queue”, “Raw”,
“Lock” , “unlock”,
“PriorityID”, 3,
“State” , “new”,
“CustomerID”, $from,
“CustomerUser”, $from,
“OwnerID”, 1,
“UserID”, 1
));
$dynfield = $client->__soapCall(“Dispatch”, array($username, $password,
“DynamicField”, “DynamicFieldGet”,
“Name”, ‘Source’));
$result = $client->__soapCall(“Dispatch”, array($username, $password,
“TicketDynamicObject”, “ValueSet”,
“FieldID”, $dynfield->ID,
“ObjectID”, $TicketID,
“Value”, array(“0” => array(“ValueText” => ‘test’)),
“UserID”, 1,
));

$ArticleID = $client->__soapCall(“Dispatch”,
array($username, $password,
“TicketObject”, “ArticleSend”,
“TicketID”, $TicketID,
“ArticleType”, “email-external”,
“SenderType”, “customer”,
“From”, $from,
“To”, $email1,
“Subject” , ‘[Ticket#’.$ticketnr.’] ‘.$title,
“ContentType” , “text/plain; charset=utf-8”,
“Charset” ,’utf-8′,
“HistoryType” , “EmailCustomer”,
“HistoryComment” , “Auto generated via PHP”,
“Body” , $body,
“UserID” , 1,
“NoAgentNotify” , 0,
“MimeType” , “text/html”,
“Loop” , 0
)
);

}
echo “<br>”;

$TicketNr = $client->__soapCall(“Dispatch”,
array($username, $password,
“TicketObject”, “TicketNumberLookup”,
“TicketID”, $TicketID,
)
);
}

create_ticket(“SUBJECT”,”TO”,”FROM”,”,”BODY”,”new”,’test’);

 

admin

admin

Enlightened

I like to receive and deal with challenging tasks. I am a very enthusiastic person and I think this is a strong point of mine. My friends say that I am a very funny with a good sense of humor. As soon as I meet new people who are happy to meet me, I feel extremely comfortable with them.

Leave a comment

You must login to add a new comment.