
Hi, It seems I got the problem. In this way otrs expects the ticket's subject and body in utf8. My database is in iso-8859-2 and it is set in Config.pm as default char set. I don't know how can I set this in soap. Regards.,Sandor Sándor Fehér írta:
Hi,
I would like to create tickets via SOAP interface. I have two problems.
1. However tickets get created succesfully otrs does not send email to customers. 2. I set the mimetype (I would like to send html emails) but they only display in plain text.
Thanks in advance.
Regards., Sandor
function create_ticket($subject,$email1,$email2,$otrs_ticket_nr,$body) {
$url = "http://192.168.1.x/otrs/rpc.pl"; $username = "api"; $password = "api"; $title = $subject; $from = "support@domain.com"; $email1 = "testagent@domain.com";
# 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)) { $TicketID = $client->__soapCall("Dispatch", array($username, $password, "TicketObject", "TicketCreate", "Title", $title, "Queue", "Raw", "Lock", "unlock", "PriorityID", 3, "State", "new", "CustomerUser", $email1, "OwnerID", 21, "UserID", 21, )); } else { $TicketID=$otrs_ticket_nr; };
//echo "tid ".$TicketID;
$ArticleID = $client->__soapCall("Dispatch", array($username, $password, "TicketObject", "ArticleSend", "TicketID", $TicketID, "ArticleType", "email-external", "SenderType", "agent", "HistoryType", "OwnerUpdate", "HistoryComment", "ff->otrs api", "From", $from, "Subject", $title, "To", $email1, "Cc", $email2, "Charset", "utf8", "MimeType", 'text/html', "Body", $body, "UserID", 21, "Loop", 1, "Attachment" , "[ { Content => 'text/html', ContentType => 'text/html', Filename => 'templates/styles_base.css', }, { Content => 'text/html', ContentType => 'text/html', Filename => 'templates/styles_base.css', }, ]", ));
# Use the Ticket ID to retrieve the Ticket Number. /*$TicketNr = $client->__soapCall("Dispatch", array($username, $password, "TicketObject", "TicketNumberLookup", "TicketID", $TicketID, ));*/
}
?>
-- Üdvözlettel/Kind Regards, Fehér Sándor ...Fehér Sándor... --- ....Sandor Feher.... fejlesztési vezető --- development manager Blue System Kft. --- Blue System Ltd. .......................................................................................... http://www.bluesystem.hu : http://www.adatmegorzo.hu : http://www.bluehosting.hu .......................................................................................... Kérem gondoljon a környezetre mielőtt kinyomtatná ezt az e-mailt vagy bármely csatolmányát. Please consider the environment before printing this e-mail and any associated attachments.