[otrs] Create ticket and send email to customers via OTRS API

580 views
Skip to first unread message

Sándor Fehér

unread,
Jul 19, 2010, 9:55:11 AM7/19/10
to User questions and discussions about OTRS.org
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

<?PHP
error_reporting(E_ALL);

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 = "sup...@domain.com";
$email1 = "test...@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.

---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW!
http://www.otrs.com/en/support/enterprise-subscription/

Sándor Fehér

unread,
Jul 20, 2010, 3:42:14 AM7/20/10
to User questions and discussions about OTRS.
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:

Reply all
Reply to author
Forward
0 new messages