PHP code example of romanpitak / dotmailer-api-v2-client
1. Go to this page and download the library: Download romanpitak/dotmailer-api-v2-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
romanpitak / dotmailer-api-v2-client example snippets
// find the correct custom from address
$customFromAddresses = $account->GetCustomFromAddresses();
$customFromAddress = null;
foreach ($customFromAddresses as $cfa) {
if ('[email protected]' == $cfa->email) {
$customFromAddress = $cfa;
break;
}
}
if (is_null($customFromAddress)) {
throw new \Exception('Custom from address not found in the account.');
}
// Create campaign to get campaign ID
// we need the campaign id later to create image folder
$campaign = new ApiCampaign();
$campaign->name = 'My API Campaign';
$campaign->subject = 'Api Works';
$campaign->fromName = "Roman Piták";
$campaign->fromAddress = $customFromAddress->toJson();
// empty content (must );
// set the dotMailer src for the images
$images[$baseName]['src'] = (string)$apiImage->path;
}
// UPDATE CAMPAIGN
$campaign->id = $campaign->id->toJson();
// getIndexHtml returns the html of the email with the correct src attribute for the images
// it uses the $images array
$htmlContent = getIndexHtml($
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.