Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Include the SendinBlue library
- require_once('../vendor/autoload.php');
- # Instantiate the client
- $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKey('api-key', 'MY API KEY HERE');
- // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
- // $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
- // Configure API key authorization: partner-key
- $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKey('partner-key', 'MY API KEY HERE');
- // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
- // $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');
- $apiInstance = new SendinBlueClientApiSMTPApi(
- // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
- // This is optional, `GuzzleHttpClient` will be used as default.
- new GuzzleHttpClient(),
- $config
- );
- $templateId = 2; // int | Id of the template
- $sendEmail = new SendinBlueClientModelSendEmail(); // SendinBlueClientModelSendEmail |
- $sendEmail['emailTo'] = array("test@example.com");
- $params['attributes'] = array('FIRSTNAME' => "STEVE"); //THIS IS THE LINE OF CODE THAT ISN'T WORKING.
- //$mail->setFrom('info@myeasy.wedding', 'My Easy Wedding');
- try {
- $result = $apiInstance->sendTemplate($templateId, $sendEmail);
- print_r($result);
- } catch (Exception $e) {
- echo 'Exception when calling SMTPApi->sendTemplate: ', $e->getMessage(), PHP_EOL;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement