How to debug ?
S-Umair opened this issue · 5 comments
How can one debug the client when all the request is returning as successful ?
code:
public function send(string $to, int $templateID, string $subject, $variable = null): ?bool
{
$mailjet = new Client(
$this->container->getParameter('sender_mail_key'),
$this->container->getParameter('sender_mail_secret'),
true,
['version' => 'v3.1']
);
$mailjet->setTimeout(10000);
$mailjet->setConnectionTimeout(10000);
$body = [
'Messages' => [
[
'From' => [
'Email' => $this->container->getParameter('sender_mail'),
'Name' => "Site Name"
],
'To' => [
[
'Email' => $to,
'Name' => ''
]
],
'TemplateID' => $templateID,
'TemplateLanguage' => true,
'TemplateErrorReporting' => [
'Email'=> $this->container->getParameter('sender_mail'),
'Name'=> "Site Name"
],
'Subject' => $subject,
'variables' => [
'var' => $variable
]
]
]
];
$response = $mailjet->post(Resources::$Email, ['body' => $body]);
dd($response->getRequest(), $response->success());
}
output:
-method: "POST"
-url: "https://api.mailjet.com/v3.1/send"
-filters: []
-body: array:1 [▼
"Messages" => array:1 [▼
0 => array:7 [▼
"From" => array:2 [▼
"Email" => "support@site.com"
"Name" => "site name"
]
"To" => array:1 [▼
0 => array:2 [▼
"Email" => "support@site.com"
"Name" => ""
]
]
"TemplateID" => 3950692
"TemplateLanguage" => true
"TemplateErrorReporting" => array:2 [▼
"Email" => "support@site.com"
"Name" => "Site Name"
]
"Subject" => "test"
"variables" => array:1 [▼
"var" => array:4 [▼
"from" => "contact@syedumair.dev"
"object" => "test"
"context" => "test"
"contact" => App\Entity\Contact {#1044 ▼
-id: null
-object: "test"
-contenu: "test"
-user: null
-dateCreate: null
-email: "contact@syedumair.dev"
}
]
]
]
]
]
-auth: array:2 [▼
0 => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
1 => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
]
-type: "application/json"
-requestOptions: array:2 [▼
"timeout" => 10000
"connect_timeout" => 10000
]
}
true // $response->success();
Personnaly i use $response->getData() for debug
@S-Umair You can use print_r for $response
What actually do you want to debug ? Maybe some specific ?
@oleksandr-mykhailenko The issue is that API is returning successful even if the domain is not verified.
@S-Umair So, I want to understand your problem. Why this is issue for you ?
Successful response itself is not only about that something was created or etc. I mean, even if domain is not verified it does not mean that the API should send you error messages. Maybe you want to check some specific setting ?
close the issues because it's not an error and according to inactivity