Created
December 28, 2019 14:58
-
-
Save c3media/590a5cf30a84f2292f90a86141ba3e5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function after_insert_budget($data) | |
{ | |
$data["params"]["tickets_id"]; | |
$data["params"]["ticket_date"]; | |
$data["params"]["id"]; | |
$data["params"]["username"]; | |
$data["params"]["fullname"]; | |
$data["params"]["phone"]; | |
$data["params"]["email"]; | |
$data["params"]["ticket_type"]; | |
$data["params"]["equipment_type"]; | |
$data["params"]["equipment_brand"]; | |
$data["params"]["equipment_model"]; | |
$data["params"]["equipment_serial"]; | |
$data["params"]["description"]; | |
$data["params"]["priority"]; | |
$data["params"]["attachment"]; | |
$data["params"]["status"]; | |
$data["params"]["ticket_note_status"]; | |
$data["params"]["last_update_by"]; | |
$client_id = $data["params"]["tickets_id"]; | |
/Variables used to send email | |
$fullname = $data["params"]["fullname"]; | |
$email = $data["params"]["email"]; | |
$ticket_type = $data["params"]["ticket_type"]; | |
// Use your saved credentials, specify that you are using Send API v3.1 | |
$mj = new \Mailjet\Client(('*******************************'), ('*********************************'),true,['version' => 'v3.1']); | |
// Define your request body | |
$body = [ | |
'Messages' => [ | |
[ | |
'From' => [ | |
'Email' => "mail@mail.com", | |
'Name' => "email sender" | |
], | |
'To' => [ | |
[ | |
'Email' => $email, | |
'name' => $fullname | |
] | |
], | |
'TemplateErrorReporting' => [ | |
'Email' => $email, | |
'name' => $fullname | |
], | |
'Variables'=> [ | |
'name'=> $fullname, | |
'service'=> $ticket_type | |
/* | |
'ticket_id'=> $client_id, | |
'equip_type'=> $equipment_type, | |
'equip_brand'=> $equipment_brand, | |
'equip_model'=> $equipment_model, | |
'equip_serial'=> $equipment_serial, | |
'equip_fail'=> $description, | |
'equip_obser'=> $observations | |
*/ | |
], | |
'TemplateID' => *******, | |
'TemplateErrorDeliver'=> true, | |
'TemplateLanguage' => true, | |
'Subject' => $ticket_type | |
] | |
] | |
]; | |
$response = $mj->post(Resources::$Email, ['body' => $body]); | |
$response->success() && var_dump($response->getData()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment