API - Send E-Mail out

Infos:

  • Used Zammad version: 2.1
  • Used Zammad installation source: source
  • Operating system: Ubuntu
  • Browser + version: All Versions

Expected behavior:

When a ticket - article with type “email” is created an email gets send by zammad to the customer.

Actual behavior:

No E-Mail gets send.

Steps to reproduce the behavior:

Using the PHP Client - I am trying to create an article in a ticket, so an email gets send to a customer. But no email is received.

ta = $client->resource( ResourceType::TICKET_ARTICLE );

$article_data = [
   'ticket_id'    => 2592,
   'to' => "test@test.com",
   'cc'    => "",
   "subject"=> "some subject",
   "body"=> "email test",
   "content_type"=>"text/html",
   "type"=> "email",
   "internal"=>false
];

$ta->setValues($article_data);
$ta->save();

Question

Is this even possible? Am I doing something wrong?

Hi,

this works fine for me:

{
  "title": "Send mail",
  "group_id": "2",
  "owner_id": "",
  "customer_id": "devnull@zammad.com",
  "state_id": "2",
  "priority_id": "2",
  "article": {
    "from": "Support",
    "to": "devnull@zammad.com",
    "cc": "",
    "body": "This is my body",
    "type_id": 1,
    "sender_id": 1,
    "content_type": "text/html"
  },
  "tags": "",
  "pending_time": null,
}

You can change state_id, type_id, sender_id with state, type, sender

state: “open”,
type: “email”,
sender: “Agent”

If you pass the correct sender(_id) and type(_id) your mail should be sent. Nothing else happens in the frontend.
EDIT: The user, which creates the ticket has to be an agent AND the value for sender (in the request) has to be Agent!

regards

Johannes

1 Like

Works like a charm! Thanks for the info.

Bastian

1 Like