//working_directory/emailBuilder.php
require_once(__DIR__ . '/vendor/autoload.php');
$credentials = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKey('api-key', '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');
$apiInstance = new SendinBlueClientApiTransactionalEmailsApi(new GuzzleHttpClient(),$credentials);
//#######################################//
$sendSmtpEmail = new SendinBlueClientModelSendSmtpEmail([
'subject' => 'Réinitialisation du mot de passe',
'sender' => ['name' => 'Clever Support', 'email' => 'contact@clever.how'],
'replyTo' => ['name' => 'Clever Support', 'email' => 'contact@clever.how'],
'to' => [[ 'name' => 'Support', 'email' => $dn['email']]],
'templateId' => 6,
'params' => ['reset_link' => 'https://clever.how/v3/reset_process.php?email='.$email.'&key='.$key.'']
]);
try {
$result = $apiInstance->sendTransacEmail($sendSmtpEmail);
// print_r($result);
$reponse = 'ok';
} catch (Exception $e) {
// echo '<small>Exception when calling TransactionalEmailsApi->sendTransacEmail: </small>', $e->getMessage(), PHP_EOL;
$reponse = 'Nous avons rencontré un problème. Merci de nous écrire à contact@clever.how';
}