SHARE
TWEET

Untitled

a guest Jun 16th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. # Include the SendinBlue library
  5. require_once('../vendor/autoload.php');
  6.  
  7. # Instantiate the client
  8.  
  9. $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKey('api-key', 'MY API KEY HERE');
  10. // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
  11. // $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
  12. // Configure API key authorization: partner-key
  13. $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKey('partner-key', 'MY API KEY HERE');
  14. // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
  15. // $config = SendinBlueClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');
  16.  
  17. $apiInstance = new SendinBlueClientApiSMTPApi(
  18.     // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
  19.     // This is optional, `GuzzleHttpClient` will be used as default.
  20.     new GuzzleHttpClient(),
  21.     $config
  22. );
  23.  
  24.  
  25. $templateId = 2; // int | Id of the template
  26.  
  27. $sendEmail = new SendinBlueClientModelSendEmail(); // SendinBlueClientModelSendEmail |
  28.  
  29.  $sendEmail['emailTo'] = array("test@example.com");
  30.  
  31. $params['attributes'] = array('FIRSTNAME' => "STEVE"); //THIS IS THE LINE OF CODE THAT ISN'T WORKING.
  32.  
  33.  
  34. //$mail->setFrom('info@myeasy.wedding', 'My Easy Wedding');
  35.  
  36.  
  37.  
  38. try {
  39.     $result = $apiInstance->sendTemplate($templateId, $sendEmail);
  40.     print_r($result);
  41. } catch (Exception $e) {
  42.     echo 'Exception when calling SMTPApi->sendTemplate: ', $e->getMessage(), PHP_EOL;
  43. }
  44.  
  45. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top