koti42 Gerek var mı paket kullanmaya:
https://sendpulse.com/integrations/api
$payload = [
'grant_type' => 'client_credentials',
'client_id' => '237b4af9c99d0f89bdbd876dcd5a0000',
'client_secret' => 'a99e7d506d3701c5c04de3db1913eeee',
];
$response = Http::withBody(json_encode($payload), 'application/json')
->throw()
->post('https://api.sendpulse.com/oauth/access_token');
$token = $response->json('access_token');
$payload = [
'email' => [
'html' => 'PHA+RXhhbXBsZSB0ZXh0PC9wPg==',
'text' => 'Example text',
'subject' => 'Example subject',
'from' => [
'name' => 'Example name',
'email' => 'sender@example.com',
],
'to' => [
[
'name' => 'Recipient1 name',
'email' => 'recipient1@example.com',
]
],
],
];
$response = Http::withToken($token)
->withBody(json_encode($payload), 'application/json')
->throw()
->post('https://api.sendpulse.com/smtp/emails');
$id = $response->json('id'); //Sonradan sorgulamak için