Skip to content

Commit

Permalink
updating Simpl-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ivikramsahu committed May 28, 2020
1 parent d442371 commit 0ccf2cf
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions simple-usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,47 @@
use PepipostLib\Models;
use PepipostLib\Exceptions;

$apiKey = 'api_key';
$apiKey = '4D51B3ECA2D4ED3A67E4E043B3F1A4D1';
$client = new PepipostLib\PepipostClient($apiKey);

$mailSendController = $client->getMailSend();
$body = new Models\Send;

$body->replyTo = 'reply-me@your-reply-to-id';
$body->from = new Models\From;

$body->from->email = 'hello@your-registered-domain-with-pepipost';
$body->from->name = 'from name';
$body->subject = 'Pepipost Test Email from PHP SDK';
$body->from->name = 'Pepipost';
$body->subject = 'Pepipost Test Mail from SDK';

$body->content = array();
$body->content[0] = new Models\Content;
$body->content[0]->type = Models\TypeEnum::HTML;
$body->content[0]->value = '<html><body>Hello [%NAME%], Email testing is successful. <br> Hope you enjoyed this integration. <br></html>';
$body->content[0]->value = '<html><body>Hello, Welcome to Pepipost Family.<br>My name is [% name %].<br>my love is sending [% love %]</body> <br></html>';

$body->personalizations = array();
$body->personalizations[0] = new Models\Personalizations;
$body->personalizations[0]->attributes = PepipostLib\APIHelper::deserialize('{"name":"Pepi","love":"Email"}');

$body->personalizations[0]->to = array();
$body->personalizations[0]->to[0] = new Models\EmailStruct;
$body->personalizations[0]->to[0]->name = 'toname';
$body->personalizations[0]->to[0]->email = 'toname@gmail.com';
$body->personalizations[0]->to[0]->name = 'to-address';
$body->personalizations[0]->to[0]->email = 'to-address@mydomain.name';

$body->personalizations[0]->cc = array();
$body->personalizations[0]->cc[0] = new Models\EmailStruct;
$body->personalizations[0]->cc[0]->name = 'to-cc-name';
$body->personalizations[0]->cc[0]->email = 'to-bcc-name';

$body->personalizations[0]->bcc = array();
$body->personalizations[0]->bcc[0] = new Models\EmailStruct;
$body->personalizations[0]->bcc[0]->name = 'to-bcc-name';
$body->personalizations[0]->bcc[0]->email = 'to-bcc-name@mydomain.name';

$body->settings = new Models\Settings;
$body->settings->footer = true;
$body->settings->clickTrack = true;
$body->settings->openTrack = true;
$body->settings->unsubscribeTrack = true;


try {
$result = $mailSendController->createGeneratethemailsendrequest($body);
Expand Down

0 comments on commit 0ccf2cf

Please sign in to comment.