📅  最后修改于: 2022-03-11 14:53:50.100000             🧑  作者: Mango
$config = new Configuration();
$config->setApiKey('api-key', $_ENV['SENDINBLUE_KEY']);
$apiInstance = new ContactsApi(
new client(),
$config
);
$apiInstance = new TransactionalEmailsApi(
new Client(),
$config
);
$sendSmtpEmail = new SendSmtpEmail();
$sendSmtpEmail['to'] = array(array('email' => $_POST['email']));
$sendSmtpEmail['templateId'] = 59;
$sendSmtpEmail['params'] = array('texte' => '', 'surname' => 'Doe');
$sendSmtpEmail['headers'] = array('X-Mailin-custom' => 'custom_header_1:custom_value_1|custom_header_2:custom_value_2');
try {
$result = $apiInstance->sendTransacEmail($sendSmtpEmail);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TransactionalEmailsApi->sendTransacEmail: ', $e->getMessage(), PHP_EOL;
}