Version Description
- 2019-09-26
- New: You can now export logs to CSV.
- Updated: Few notifications errors, and minor improvements.
Download this release
Release Info
Developer | yehudah |
Plugin | Post SMTP Mailer/Email Log |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- Postman/Postman-Configuration/PostmanConfigurationController.php +12 -10
- Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php +12 -3
- Postman/Postman-Configuration/postman_manual_config.js +3 -0
- Postman/Postman-Configuration/postman_wizard.js +2 -0
- Postman/Postman-Connectivity-Test/registered-domain-libs-master/.gitignore +0 -3
- Postman/Postman-Email-Log/PostmanEmailLogController.php +62 -15
- Postman/Postman-Email-Log/PostmanEmailLogService.php +3 -1
- Postman/Postman-Email-Log/PostmanEmailLogView.php +8 -9
- Postman/Postman-Mail/google-api-client/vendor/google/apiclient-services/.gitignore +0 -4
- Postman/Postman-Mail/google-api-client/vendor/google/auth/.gitignore +0 -3
- Postman/Postman-Mail/google-api-client/vendor/psr/log/.gitignore +0 -1
- Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore +0 -2
- Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/.gitignore +0 -3
- Postman/Postman-Mail/mailgun/vendor/webmozart/assert/.gitignore +0 -2
- Postman/Postman-Mail/sendgrid/.gitignore +0 -7
- Postman/Postman-Mail/sendgrid/composer.lock +128 -0
- Postman/Postman-Mail/sendgrid/sendgrid-php.php +5 -0
- Postman/Postman-Mail/sendgrid/vendor/autoload.php +7 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/ClassLoader.php +413 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/LICENSE +433 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/autoload_classmap.php +9 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php +10 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/autoload_namespaces.php +9 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php +13 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php +59 -0
- Postman/Postman-Mail/sendgrid/vendor/composer/installed.json +115 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.codeclimate.yml +18 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE +17 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/PULL_REQUEST_TEMPLATE +24 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml +27 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md +201 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/Dockerfile +13 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt +22 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md +195 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json +36 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php +596 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php +113 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.codeclimate.yml +11 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.editorconfig +8 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.env.sample +1 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/PULL_REQUEST_TEMPLATE +26 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml +33 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CODE_OF_CONDUCT.md +38 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/LICENSE.md +21 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md +232 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json +47 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/docker/Dockerfile +22 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/docker/README.md +50 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/docker/entrypoint.sh +15 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php +77 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/contacts/README.md +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/contacts/Recipient.php +92 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/contacts/RecipientForm.php +55 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php +54 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Asm.php +150 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Attachment.php +235 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/BatchId.php +75 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Bcc.php +24 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/BccSettings.php +118 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/BypassListManagement.php +87 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Category.php +77 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Cc.php +24 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/ClickTracking.php +114 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Content.php +118 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/CustomArg.php +119 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/EmailAddress.php +222 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Footer.php +144 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/From.php +24 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Ganalytics.php +251 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/GroupId.php +73 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/GroupsToDisplay.php +87 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Header.php +116 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/HtmlContent.php +33 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/IpPoolName.php +77 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Mail.php +1911 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/MailSettings.php +274 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/MimeType.php +26 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/OpenTracking.php +124 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Personalization.php +312 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/PlainTextContent.php +33 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/README.md +14 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/ReplyTo.php +24 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SandBoxMode.php +80 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Section.php +115 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SendAt.php +102 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SpamCheck.php +161 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Subject.php +74 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SubscriptionTracking.php +228 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Substitution.php +120 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/TemplateId.php +86 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/To.php +24 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/TrackingSettings.php +252 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/TypeException.php +7 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/stats/Stats.php +269 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/phpcs.xml +196 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/package.sh +9 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/sendgrid-php.php +3 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/BaseTestClass.php +70 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/data/test.txt +1 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Alerts/AlertsTest.php +52 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/ApiKeys/ApiKeysTest.php +74 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Asm/AsmGroupsTest.php +105 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Asm/AsmSuppressionTest.php +52 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Campaigns/CampaignsTest.php +134 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Categories/CategoriesTest.php +32 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Contacts/ContactDbTest.php +424 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Ip/IpPoolsTest.php +72 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Ip/IpsTest.php +31 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Ip/IpsWarmupTest.php +41 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailBatchTest.php +23 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailSendTest.php +153 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailSettingsTest.php +183 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailboxProvidersTest.php +18 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Scopes/ScopesTest.php +15 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/SenderAuthentication/DomainAuthenticationTest.php +124 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/SenderAuthentication/LinkBrandingTest.php +99 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/SenderAuthentication/ReverseDNSTest.php +52 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Senders/SendersTest.php +99 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Settings/AccessSettingsTest.php +76 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Settings/PartnerSettingsTest.php +35 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Settings/TrackingSettingsTest.php +94 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/BrowserStatsTest.php +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/ClientsStatsTest.php +25 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/DevicesStatsTest.php +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/GeoStatsTest.php +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/StatsTest.php +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Subusers/SubUsersTest.php +155 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionBlocksTest.php +46 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionBouncesTest.php +47 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionInvalidEmailsTest.php +46 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionSpamReportsTest.php +46 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionUnsubscribesTest.php +16 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Templates/TemplatesTest.php +114 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Users/UserTest.php +274 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/helpers/contacts/RecipientsTest.php +31 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/helpers/stats/StatsTest.php +238 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/phpunit.xml.dist +8 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/prism.sh +63 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/AttachmentsTest.php +45 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/DynamicTemplateTest.php +415 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/FilesExistTest.php +48 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/KitchenSinkTest.php +1229 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/MailGetContentsTest.php +38 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/MailHelperTest.php +84 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/MultipleEmailToMultipleRecipientsTest.php +517 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SendGridTest.php +88 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SingleEmailToASingleRecipientTest.php +98 -0
- Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SingleEmailToMultipleRecipientsTest.php +117 -0
- Postman/Postman.php +3 -3
- Postman/PostmanAdminController.php +3 -1
- Postman/PostmanAjaxController.php +8 -1
- Postman/PostmanInputSanitizer.php +5 -3
- Postman/PostmanLogFields.php +63 -10
- Postman/PostmanPluginFeedback.php +2 -2
- Postman/PostmanViewController.php +8 -4
- Postman/PostmanWpMail.php +2 -1
- postman-smtp.php +15 -7
- readme.txt +6 -3
- style/postman-email-log.css +3 -2
Postman/Postman-Configuration/PostmanConfigurationController.php
CHANGED
@@ -390,17 +390,19 @@ class PostmanConfigurationController {
|
|
390 |
print '<section id="notifications">';
|
391 |
do_settings_sections( PostmanAdminController::NOTIFICATIONS_OPTIONS );
|
392 |
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
|
|
404 |
|
405 |
print '</section>';
|
406 |
|
@@ -608,7 +610,7 @@ class PostmanConfigurationController {
|
|
608 |
Postman::getMailerTypeRecommend();
|
609 |
|
610 |
$in_wizard = true;
|
611 |
-
include_once
|
612 |
|
613 |
print '</section>';
|
614 |
print '</fieldset>';
|
390 |
print '<section id="notifications">';
|
391 |
do_settings_sections( PostmanAdminController::NOTIFICATIONS_OPTIONS );
|
392 |
|
393 |
+
$currentKey = $this->options->getNotificationService();
|
394 |
+
$pushover = $currentKey == 'pushover' ? 'block' : 'none';
|
395 |
+
$slack = $currentKey == 'slack' ? 'block' : 'none';
|
396 |
|
397 |
+
echo '<div id="pushover_cred" style="display: ' . $pushover . ';">';
|
398 |
+
do_settings_sections( PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED );
|
399 |
+
echo '</div>';
|
400 |
|
401 |
+
echo '<div id="slack_cred" style="display: ' . $slack . ';">';
|
402 |
+
do_settings_sections( PostmanAdminController::NOTIFICATIONS_SLACK_CRED );
|
403 |
+
echo '</div>';
|
404 |
+
|
405 |
+
do_action( 'post_smtp_notification_settings' );
|
406 |
|
407 |
print '</section>';
|
408 |
|
610 |
Postman::getMailerTypeRecommend();
|
611 |
|
612 |
$in_wizard = true;
|
613 |
+
include_once POST_SMTP_PATH . '/Postman/extra/donation.php';
|
614 |
|
615 |
print '</section>';
|
616 |
print '</fieldset>';
|
Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
CHANGED
@@ -234,6 +234,7 @@ class PostmanSettingsRegistry {
|
|
234 |
'notification_chrome_uid_callback',
|
235 |
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
|
236 |
|
|
|
237 |
}
|
238 |
}
|
239 |
|
@@ -443,12 +444,20 @@ class PostmanSettingsRegistry {
|
|
443 |
|
444 |
public function notification_service_callback() {
|
445 |
$inputDescription = __( 'Select the notification service you want to recieve alerts about failed emails.' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_SERVICE );
|
447 |
$currentKey = $this->options->getNotificationService();
|
448 |
|
449 |
-
|
450 |
-
|
451 |
-
|
|
|
452 |
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
|
453 |
}
|
454 |
|
234 |
'notification_chrome_uid_callback',
|
235 |
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
|
236 |
|
237 |
+
do_action( 'post_smtp_settings' );
|
238 |
}
|
239 |
}
|
240 |
|
444 |
|
445 |
public function notification_service_callback() {
|
446 |
$inputDescription = __( 'Select the notification service you want to recieve alerts about failed emails.' );
|
447 |
+
|
448 |
+
$options = apply_filters('post_smtp_notification_service', array(
|
449 |
+
'default' => __( 'WP Admin Email', 'post-smtp' ),
|
450 |
+
'pushover' => __( 'Pushover', 'post-smtp' ),
|
451 |
+
'slack' => __( 'Slack', 'post-smtp' ),
|
452 |
+
));
|
453 |
+
|
454 |
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_SERVICE );
|
455 |
$currentKey = $this->options->getNotificationService();
|
456 |
|
457 |
+
foreach ( $options as $key => $label ) {
|
458 |
+
$this->printSelectOption( $label, $key, $currentKey );
|
459 |
+
}
|
460 |
+
|
461 |
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
|
462 |
}
|
463 |
|
Postman/Postman-Configuration/postman_manual_config.js
CHANGED
@@ -40,6 +40,9 @@ jQuery(document).ready(
|
|
40 |
$('#pushover_cred').fadeOut('fast');
|
41 |
$('#slack_cred').fadeIn();
|
42 |
}
|
|
|
|
|
|
|
43 |
});
|
44 |
|
45 |
|
40 |
$('#pushover_cred').fadeOut('fast');
|
41 |
$('#slack_cred').fadeIn();
|
42 |
}
|
43 |
+
|
44 |
+
Hook.call( 'post_smtp_notification_change', selected );
|
45 |
+
|
46 |
});
|
47 |
|
48 |
|
Postman/Postman-Configuration/postman_wizard.js
CHANGED
@@ -517,6 +517,8 @@ function handleConfigurationResponse(response) {
|
|
517 |
jQuery('#pushover_cred').fadeOut('fast');
|
518 |
jQuery('#slack_cred').fadeIn();
|
519 |
}
|
|
|
|
|
520 |
});
|
521 |
|
522 |
// add an event on the user port override field
|
517 |
jQuery('#pushover_cred').fadeOut('fast');
|
518 |
jQuery('#slack_cred').fadeIn();
|
519 |
}
|
520 |
+
|
521 |
+
Hook.call( 'post_smtp_notification_change', selected );
|
522 |
});
|
523 |
|
524 |
// add an event on the user port override field
|
Postman/Postman-Connectivity-Test/registered-domain-libs-master/.gitignore
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
C/*.o
|
2 |
-
C/libregdom.so.1
|
3 |
-
C/test-regdom
|
|
|
|
|
|
Postman/Postman-Email-Log/PostmanEmailLogController.php
CHANGED
@@ -72,8 +72,48 @@ class PostmanEmailLogController {
|
|
72 |
PostmanViewController::JQUERY_SCRIPT,
|
73 |
PostmanViewController::POSTMAN_SCRIPT,
|
74 |
), $pluginData ['version'] );
|
|
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
/**
|
78 |
*/
|
79 |
public function resendMail() {
|
@@ -91,7 +131,7 @@ class PostmanEmailLogController {
|
|
91 |
$to = $meta_values ['original_to'] [0];
|
92 |
}
|
93 |
|
94 |
-
$success = wp_mail( $to, $meta_values ['original_subject'] [0],
|
95 |
|
96 |
// Postman API: retrieve the result of sending this message from Postman
|
97 |
$result = apply_filters( 'postman_wp_mail_result', null );
|
@@ -158,21 +198,21 @@ class PostmanEmailLogController {
|
|
158 |
if ( PostmanUtils::isAdmin() && isset( $_REQUEST ['email_log_entry'] ) ) {
|
159 |
$this->logger->trace( 'handling bulk action' );
|
160 |
if ( wp_verify_nonce( $_REQUEST ['_wpnonce'], 'bulk-email_log_entries' ) ) {
|
161 |
-
$this->logger->trace( sprintf( 'nonce "%s" passed validation', $_REQUEST ['_wpnonce'] ) );
|
162 |
if ( isset( $_REQUEST ['action'] ) && ($_REQUEST ['action'] == 'bulk_delete' || $_REQUEST ['action2'] == 'bulk_delete') ) {
|
163 |
$this->logger->trace( sprintf( 'handling bulk delete' ) );
|
164 |
$purger = new PostmanEmailLogPurger();
|
165 |
-
$postids = $_REQUEST ['email_log_entry'];
|
166 |
foreach ( $postids as $postid ) {
|
167 |
$purger->verifyLogItemExistsAndRemove( $postid );
|
168 |
}
|
169 |
$mh = new PostmanMessageHandler();
|
170 |
$mh->addMessage( __( 'Mail Log Entries were deleted.', 'post-smtp' ) );
|
171 |
} else {
|
172 |
-
$this->logger->warn( sprintf( 'action "%s" not recognized', $_REQUEST ['action'] ) );
|
173 |
}
|
174 |
} else {
|
175 |
-
$this->logger->warn( sprintf( 'nonce "%s" failed validation', $_REQUEST ['_wpnonce'] ) );
|
176 |
}
|
177 |
$this->redirectToLogPage();
|
178 |
}
|
@@ -184,15 +224,15 @@ class PostmanEmailLogController {
|
|
184 |
// only do this for administrators
|
185 |
if ( PostmanUtils::isAdmin() ) {
|
186 |
$this->logger->trace( 'handling delete item' );
|
187 |
-
$postid = $_REQUEST ['email'];
|
188 |
if ( wp_verify_nonce( $_REQUEST ['_wpnonce'], 'delete_email_log_item_' . $postid ) ) {
|
189 |
-
$this->logger->trace( sprintf( 'nonce "%s" passed validation', $_REQUEST ['_wpnonce'] ) );
|
190 |
$purger = new PostmanEmailLogPurger();
|
191 |
$purger->verifyLogItemExistsAndRemove( $postid );
|
192 |
$mh = new PostmanMessageHandler();
|
193 |
$mh->addMessage( __( 'Mail Log Entry was deleted.', 'post-smtp' ) );
|
194 |
} else {
|
195 |
-
$this->logger->warn( sprintf( 'nonce "%s" failed validation', $_REQUEST ['_wpnonce'] ) );
|
196 |
}
|
197 |
$this->redirectToLogPage();
|
198 |
}
|
@@ -267,7 +307,7 @@ class PostmanEmailLogController {
|
|
267 |
// only do this for administrators
|
268 |
if ( PostmanUtils::isAdmin() ) {
|
269 |
$this->logger->trace( 'handling view transcript item' );
|
270 |
-
$postid = $_REQUEST ['email'];
|
271 |
$post = get_post( $postid );
|
272 |
$meta_values = PostmanLogFields::get_instance()->get( $postid );
|
273 |
// https://css-tricks.com/examples/hrs/
|
@@ -360,7 +400,7 @@ class PostmanEmailLogController {
|
|
360 |
/* Translators where (%s) is the name of the plugin */
|
361 |
echo sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) )?></h2>
|
362 |
|
363 |
-
<?php include_once
|
364 |
|
365 |
<div
|
366 |
style="background: #ECECEC; border: 1px solid #CCC; padding: 0 10px; margin-top: 5px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;">
|
@@ -404,14 +444,21 @@ class PostmanEmailLogController {
|
|
404 |
}
|
405 |
?>
|
406 |
</select>
|
407 |
-
</div>
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
409 |
<button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter/Search', 'post-smtp' ); ?></button>
|
410 |
-
</div>
|
|
|
411 |
<div class="form-control">
|
412 |
<button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', 'post-smtp' ); ?></button>
|
413 |
-
</div>
|
414 |
-
|
|
|
415 |
<div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div>
|
416 |
</form>
|
417 |
|
72 |
PostmanViewController::JQUERY_SCRIPT,
|
73 |
PostmanViewController::POSTMAN_SCRIPT,
|
74 |
), $pluginData ['version'] );
|
75 |
+
$this->handleCsvExport();
|
76 |
}
|
77 |
|
78 |
+
function handleCsvExport() {
|
79 |
+
if ( ! empty( $_POST ) && ! wp_verify_nonce( $_REQUEST['post-smtp-log'], 'post-smtp' ) )
|
80 |
+
die( 'Security check' );
|
81 |
+
|
82 |
+
if ( isset( $_POST['postman_export_csv'] ) && current_user_can( Postman::MANAGE_POSTMAN_CAPABILITY_LOGS ) ) {
|
83 |
+
$args = array(
|
84 |
+
'post_type' => PostmanEmailLogPostType::POSTMAN_CUSTOM_POST_TYPE_SLUG,
|
85 |
+
'post_status' => PostmanEmailLogService::POSTMAN_CUSTOM_POST_STATUS_PRIVATE,
|
86 |
+
'posts_per_page' => -1,
|
87 |
+
);
|
88 |
+
$logs = new WP_Query($args);
|
89 |
+
|
90 |
+
if ( empty( $logs->posts ) ) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
header('Content-Type: text/csv');
|
95 |
+
header('Content-Disposition: attachment; filename="email-logs.csv"');
|
96 |
+
|
97 |
+
$fp = fopen('php://output', 'wb');
|
98 |
+
|
99 |
+
$headers = array_keys( PostmanLogFields::get_instance()->get_fields() );
|
100 |
+
fputcsv($fp, $headers);
|
101 |
+
|
102 |
+
foreach ( $logs->posts as $log ) {
|
103 |
+
$meta = PostmanLogFields::get_instance()->get($log->ID);
|
104 |
+
$data = [];
|
105 |
+
foreach ( $meta as $header => $line ) {
|
106 |
+
$data[] = $line[0];
|
107 |
+
}
|
108 |
+
fputcsv($fp, $data);
|
109 |
+
}
|
110 |
+
|
111 |
+
fclose($fp);
|
112 |
+
die();
|
113 |
+
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
/**
|
118 |
*/
|
119 |
public function resendMail() {
|
131 |
$to = $meta_values ['original_to'] [0];
|
132 |
}
|
133 |
|
134 |
+
$success = wp_mail( $to, $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] );
|
135 |
|
136 |
// Postman API: retrieve the result of sending this message from Postman
|
137 |
$result = apply_filters( 'postman_wp_mail_result', null );
|
198 |
if ( PostmanUtils::isAdmin() && isset( $_REQUEST ['email_log_entry'] ) ) {
|
199 |
$this->logger->trace( 'handling bulk action' );
|
200 |
if ( wp_verify_nonce( $_REQUEST ['_wpnonce'], 'bulk-email_log_entries' ) ) {
|
201 |
+
$this->logger->trace( sprintf( 'nonce "%s" passed validation', sanitize_text_field($_REQUEST ['_wpnonce']) ) );
|
202 |
if ( isset( $_REQUEST ['action'] ) && ($_REQUEST ['action'] == 'bulk_delete' || $_REQUEST ['action2'] == 'bulk_delete') ) {
|
203 |
$this->logger->trace( sprintf( 'handling bulk delete' ) );
|
204 |
$purger = new PostmanEmailLogPurger();
|
205 |
+
$postids = array_map( 'absint', $_REQUEST ['email_log_entry'] );
|
206 |
foreach ( $postids as $postid ) {
|
207 |
$purger->verifyLogItemExistsAndRemove( $postid );
|
208 |
}
|
209 |
$mh = new PostmanMessageHandler();
|
210 |
$mh->addMessage( __( 'Mail Log Entries were deleted.', 'post-smtp' ) );
|
211 |
} else {
|
212 |
+
$this->logger->warn( sprintf( 'action "%s" not recognized', sanitize_text_field($_REQUEST ['action']) ) );
|
213 |
}
|
214 |
} else {
|
215 |
+
$this->logger->warn( sprintf( 'nonce "%s" failed validation', sanitize_text_field($_REQUEST ['_wpnonce']) ) );
|
216 |
}
|
217 |
$this->redirectToLogPage();
|
218 |
}
|
224 |
// only do this for administrators
|
225 |
if ( PostmanUtils::isAdmin() ) {
|
226 |
$this->logger->trace( 'handling delete item' );
|
227 |
+
$postid = absint($_REQUEST ['email']);
|
228 |
if ( wp_verify_nonce( $_REQUEST ['_wpnonce'], 'delete_email_log_item_' . $postid ) ) {
|
229 |
+
$this->logger->trace( sprintf( 'nonce "%s" passed validation', sanitize_text_field($_REQUEST ['_wpnonce']) ) );
|
230 |
$purger = new PostmanEmailLogPurger();
|
231 |
$purger->verifyLogItemExistsAndRemove( $postid );
|
232 |
$mh = new PostmanMessageHandler();
|
233 |
$mh->addMessage( __( 'Mail Log Entry was deleted.', 'post-smtp' ) );
|
234 |
} else {
|
235 |
+
$this->logger->warn( sprintf( 'nonce "%s" failed validation', sanitize_text_field($_REQUEST ['_wpnonce']) ) );
|
236 |
}
|
237 |
$this->redirectToLogPage();
|
238 |
}
|
307 |
// only do this for administrators
|
308 |
if ( PostmanUtils::isAdmin() ) {
|
309 |
$this->logger->trace( 'handling view transcript item' );
|
310 |
+
$postid = absint($_REQUEST ['email']);
|
311 |
$post = get_post( $postid );
|
312 |
$meta_values = PostmanLogFields::get_instance()->get( $postid );
|
313 |
// https://css-tricks.com/examples/hrs/
|
400 |
/* Translators where (%s) is the name of the plugin */
|
401 |
echo sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) )?></h2>
|
402 |
|
403 |
+
<?php include_once POST_SMTP_PATH . '/Postman/extra/donation.php'; ?>
|
404 |
|
405 |
<div
|
406 |
style="background: #ECECEC; border: 1px solid #CCC; padding: 0 10px; margin-top: 5px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;">
|
444 |
}
|
445 |
?>
|
446 |
</select>
|
447 |
+
</div>
|
448 |
+
|
449 |
+
<div class="form-control">
|
450 |
+
<button type="submit" id="postman_export_csv" name="postman_export_csv" class="button button-primary"><?php _e( 'Export To CSV', 'post-smtp' ); ?></button>
|
451 |
+
</div>
|
452 |
+
|
453 |
+
<div class="form-control" style="padding: 0 5px 0 5px; margin-right: 50px;">
|
454 |
<button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter/Search', 'post-smtp' ); ?></button>
|
455 |
+
</div>
|
456 |
+
|
457 |
<div class="form-control">
|
458 |
<button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', 'post-smtp' ); ?></button>
|
459 |
+
</div>
|
460 |
+
|
461 |
+
</div>
|
462 |
<div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div>
|
463 |
</form>
|
464 |
|
Postman/Postman-Email-Log/PostmanEmailLogService.php
CHANGED
@@ -193,7 +193,7 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) {
|
|
193 |
$message .= "\r\n" . __( 'The log to paste when you open a support issue:', 'post-smtp' ) . "\r\n";
|
194 |
|
195 |
if ( $log->statusMessage && ! empty( $log->statusMessage ) ) {
|
196 |
-
require_once
|
197 |
|
198 |
$message = $message . $log->statusMessage;
|
199 |
|
@@ -212,6 +212,8 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) {
|
|
212 |
$notifyer = new PostmanMailNotify;
|
213 |
}
|
214 |
|
|
|
|
|
215 |
// Notifications
|
216 |
$notify = new PostmanNotify( $notifyer );
|
217 |
$notify->send($message, $log);
|
193 |
$message .= "\r\n" . __( 'The log to paste when you open a support issue:', 'post-smtp' ) . "\r\n";
|
194 |
|
195 |
if ( $log->statusMessage && ! empty( $log->statusMessage ) ) {
|
196 |
+
require_once POST_SMTP_PATH . '/Postman/notifications/PostmanNotify.php';
|
197 |
|
198 |
$message = $message . $log->statusMessage;
|
199 |
|
212 |
$notifyer = new PostmanMailNotify;
|
213 |
}
|
214 |
|
215 |
+
$notifyer = apply_filters( 'post_smtp_notifier', $notifyer, $notification_service );
|
216 |
+
|
217 |
// Notifications
|
218 |
$notify = new PostmanNotify( $notifyer );
|
219 |
$notify->send($message, $log);
|
Postman/Postman-Email-Log/PostmanEmailLogView.php
CHANGED
@@ -110,9 +110,10 @@ class PostmanEmailLogView extends WP_List_Table {
|
|
110 |
}
|
111 |
if ( ! (empty( $meta_values ['original_to'] [0] ) && empty( $meta_values ['originalHeaders'] [0] )) ) {
|
112 |
// $actions ['resend'] = sprintf ( '<a href="%s">%s</a>', $resendUrl, __ ( 'Resend', 'post-smtp' ) );
|
113 |
-
$emails =
|
114 |
-
|
115 |
-
|
|
|
116 |
} else {
|
117 |
$actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', 'post-smtp' ) );
|
118 |
}
|
@@ -262,10 +263,8 @@ class PostmanEmailLogView extends WP_List_Table {
|
|
262 |
* ************************************************************************
|
263 |
*/
|
264 |
function prepare_items() {
|
265 |
-
|
266 |
-
|
267 |
-
die( 'Security check' );
|
268 |
-
}
|
269 |
|
270 |
/**
|
271 |
* First, lets decide how many records per page to show
|
@@ -396,8 +395,8 @@ class PostmanEmailLogView extends WP_List_Table {
|
|
396 |
* sorting technique would be unnecessary.
|
397 |
*/
|
398 |
function usort_reorder( $a, $b ) {
|
399 |
-
$orderby = ( ! empty( $_REQUEST ['orderby'] )) ? $_REQUEST ['orderby'] : 'title'; // If no sort, default to title
|
400 |
-
$order = ( ! empty( $_REQUEST ['order'] )) ? $_REQUEST ['order'] : 'asc'; // If no order, default to asc
|
401 |
$result = strcmp( $a [ $orderby ], $b [ $orderby ] ); // Determine sort order
|
402 |
return ($order === 'asc') ? $result : - $result; // Send final sort direction to usort
|
403 |
}
|
110 |
}
|
111 |
if ( ! (empty( $meta_values ['original_to'] [0] ) && empty( $meta_values ['originalHeaders'] [0] )) ) {
|
112 |
// $actions ['resend'] = sprintf ( '<a href="%s">%s</a>', $resendUrl, __ ( 'Resend', 'post-smtp' ) );
|
113 |
+
$emails = $meta_values ['original_to'] [0];
|
114 |
+
$to = is_array( $emails ) ? implode( ',', array_walk($emails, 'sanitize_email') ) : sanitize_email( $emails );
|
115 |
+
|
116 |
+
$actions ['resend'] = sprintf( '<span id="%3$s"><a class="postman-open-resend" href="#">%2$s</a></span><div style="display:none;"><input type="hidden" name="security" value="%6$s"><input type="text" name="mail_to" class="regular-text ltr" data-id="%1$s" value="%4$s"><button class="postman-resend button button-primary">%2$s</button><i style="color: black;">%5$s</i></div>', $item ['ID'], __( 'Resend', 'post-smtp' ), 'resend-' . $item ['ID'], esc_attr( $to ), __( 'comma-separated for multiple emails', 'post-smtp' ), wp_create_nonce( 'resend' ) );
|
117 |
} else {
|
118 |
$actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', 'post-smtp' ) );
|
119 |
}
|
263 |
* ************************************************************************
|
264 |
*/
|
265 |
function prepare_items() {
|
266 |
+
if ( ! empty( $_POST ) && ! wp_verify_nonce( $_REQUEST['post-smtp-log'], 'post-smtp' ) )
|
267 |
+
die( 'Security check' );
|
|
|
|
|
268 |
|
269 |
/**
|
270 |
* First, lets decide how many records per page to show
|
395 |
* sorting technique would be unnecessary.
|
396 |
*/
|
397 |
function usort_reorder( $a, $b ) {
|
398 |
+
$orderby = ( ! empty( $_REQUEST ['orderby'] )) ? sanitize_text_field($_REQUEST ['orderby']) : 'title'; // If no sort, default to title
|
399 |
+
$order = ( ! empty( $_REQUEST ['order'] )) ? sanitize_text_field($_REQUEST ['order']) : 'asc'; // If no order, default to asc
|
400 |
$result = strcmp( $a [ $orderby ], $b [ $orderby ] ); // Determine sort order
|
401 |
return ($order === 'asc') ? $result : - $result; // Send final sort direction to usort
|
402 |
}
|
Postman/Postman-Mail/google-api-client/vendor/google/apiclient-services/.gitignore
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
vendor
|
2 |
-
composer.lock
|
3 |
-
src/Google/Service/Compute/HTTPHealthCheck.php
|
4 |
-
src/Google/Service/Compute/HTTPSHealthCheck.php
|
|
|
|
|
|
|
|
Postman/Postman-Mail/google-api-client/vendor/google/auth/.gitignore
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
*~
|
2 |
-
vendor
|
3 |
-
composer.lock
|
|
|
|
|
|
Postman/Postman-Mail/google-api-client/vendor/psr/log/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
vendor
|
|
Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/.gitignore
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/vendor
|
2 |
-
/composer.lock
|
|
|
|
Postman/Postman-Mail/mailgun/vendor/symfony/options-resolver/.gitignore
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
vendor/
|
2 |
-
composer.lock
|
3 |
-
phpunit.xml
|
|
|
|
|
|
Postman/Postman-Mail/mailgun/vendor/webmozart/assert/.gitignore
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/vendor/
|
2 |
-
composer.lock
|
|
|
|
Postman/Postman-Mail/sendgrid/.gitignore
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
test/coverage/*
|
2 |
-
examples/*
|
3 |
-
dist/
|
4 |
-
composer.lock
|
5 |
-
vendor
|
6 |
-
.env*
|
7 |
-
sendgrid-php.php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Postman/Postman-Mail/sendgrid/composer.lock
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"hash": "cb037c28e262c69616caad2764cb3a4f",
|
8 |
+
"content-hash": "907e285f65325b51e424d991537f18af",
|
9 |
+
"packages": [
|
10 |
+
{
|
11 |
+
"name": "sendgrid/php-http-client",
|
12 |
+
"version": "3.9.6",
|
13 |
+
"source": {
|
14 |
+
"type": "git",
|
15 |
+
"url": "https://github.com/sendgrid/php-http-client.git",
|
16 |
+
"reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7"
|
17 |
+
},
|
18 |
+
"dist": {
|
19 |
+
"type": "zip",
|
20 |
+
"url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/e9a04d949ee2d19938ab83dc100933a3b41a8ec7",
|
21 |
+
"reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7",
|
22 |
+
"shasum": ""
|
23 |
+
},
|
24 |
+
"require": {
|
25 |
+
"php": ">=5.6"
|
26 |
+
},
|
27 |
+
"require-dev": {
|
28 |
+
"phpunit/phpunit": "~4.4",
|
29 |
+
"squizlabs/php_codesniffer": "~2.0"
|
30 |
+
},
|
31 |
+
"type": "library",
|
32 |
+
"autoload": {
|
33 |
+
"psr-4": {
|
34 |
+
"SendGrid\\": "lib/"
|
35 |
+
}
|
36 |
+
},
|
37 |
+
"notification-url": "https://packagist.org/downloads/",
|
38 |
+
"license": [
|
39 |
+
"MIT"
|
40 |
+
],
|
41 |
+
"authors": [
|
42 |
+
{
|
43 |
+
"name": "Matt Bernier",
|
44 |
+
"email": "dx@sendgrid.com"
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"name": "Elmer Thomas",
|
48 |
+
"email": "elmer@thinkingserious.com"
|
49 |
+
}
|
50 |
+
],
|
51 |
+
"description": "HTTP REST client, simplified for PHP",
|
52 |
+
"homepage": "http://github.com/sendgrid/php-http-client",
|
53 |
+
"keywords": [
|
54 |
+
"api",
|
55 |
+
"fluent",
|
56 |
+
"http",
|
57 |
+
"rest",
|
58 |
+
"sendgrid"
|
59 |
+
],
|
60 |
+
"time": "2018-04-10 18:06:08"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"name": "sendgrid/sendgrid",
|
64 |
+
"version": "7.3.0",
|
65 |
+
"source": {
|
66 |
+
"type": "git",
|
67 |
+
"url": "https://github.com/sendgrid/sendgrid-php.git",
|
68 |
+
"reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d"
|
69 |
+
},
|
70 |
+
"dist": {
|
71 |
+
"type": "zip",
|
72 |
+
"url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/37fa19d3ae019842f07a2a43e92ed0f566ad927d",
|
73 |
+
"reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d",
|
74 |
+
"shasum": ""
|
75 |
+
},
|
76 |
+
"require": {
|
77 |
+
"ext-curl": "*",
|
78 |
+
"ext-json": "*",
|
79 |
+
"ext-mbstring": "*",
|
80 |
+
"ext-openssl": "*",
|
81 |
+
"php": ">=5.6",
|
82 |
+
"sendgrid/php-http-client": "~3.9"
|
83 |
+
},
|
84 |
+
"replace": {
|
85 |
+
"sendgrid/sendgrid-php": "*"
|
86 |
+
},
|
87 |
+
"require-dev": {
|
88 |
+
"phpunit/phpunit": "^5.7.9 || ^6.4.3",
|
89 |
+
"squizlabs/php_codesniffer": "3.*",
|
90 |
+
"swaggest/json-diff": "^3.4"
|
91 |
+
},
|
92 |
+
"type": "library",
|
93 |
+
"autoload": {
|
94 |
+
"psr-4": {
|
95 |
+
"SendGrid\\": "lib/",
|
96 |
+
"SendGrid\\Mail\\": "lib/mail/",
|
97 |
+
"SendGrid\\Contacts\\": "lib/contacts/",
|
98 |
+
"SendGrid\\Stats\\": "lib/stats/"
|
99 |
+
},
|
100 |
+
"files": [
|
101 |
+
"lib/SendGrid.php"
|
102 |
+
]
|
103 |
+
},
|
104 |
+
"notification-url": "https://packagist.org/downloads/",
|
105 |
+
"license": [
|
106 |
+
"MIT"
|
107 |
+
],
|
108 |
+
"description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.",
|
109 |
+
"homepage": "http://github.com/sendgrid/sendgrid-php",
|
110 |
+
"keywords": [
|
111 |
+
"email",
|
112 |
+
"grid",
|
113 |
+
"send",
|
114 |
+
"sendgrid",
|
115 |
+
"twilio sendgrid"
|
116 |
+
],
|
117 |
+
"time": "2019-04-15 17:27:21"
|
118 |
+
}
|
119 |
+
],
|
120 |
+
"packages-dev": [],
|
121 |
+
"aliases": [],
|
122 |
+
"minimum-stability": "stable",
|
123 |
+
"stability-flags": [],
|
124 |
+
"prefer-stable": false,
|
125 |
+
"prefer-lowest": false,
|
126 |
+
"platform": [],
|
127 |
+
"platform-dev": []
|
128 |
+
}
|
Postman/Postman-Mail/sendgrid/sendgrid-php.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists('\\SendGrid\\Client') ) {
|
3 |
+
require 'vendor/autoload.php';
|
4 |
+
}
|
5 |
+
?>
|
Postman/Postman-Mail/sendgrid/vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9::getLoader();
|
Postman/Postman-Mail/sendgrid/vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
|
57 |
+
private $classMapAuthoritative = false;
|
58 |
+
|
59 |
+
public function getPrefixes()
|
60 |
+
{
|
61 |
+
if (!empty($this->prefixesPsr0)) {
|
62 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
63 |
+
}
|
64 |
+
|
65 |
+
return array();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getPrefixesPsr4()
|
69 |
+
{
|
70 |
+
return $this->prefixDirsPsr4;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getFallbackDirs()
|
74 |
+
{
|
75 |
+
return $this->fallbackDirsPsr0;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getFallbackDirsPsr4()
|
79 |
+
{
|
80 |
+
return $this->fallbackDirsPsr4;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getClassMap()
|
84 |
+
{
|
85 |
+
return $this->classMap;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param array $classMap Class to filename map
|
90 |
+
*/
|
91 |
+
public function addClassMap(array $classMap)
|
92 |
+
{
|
93 |
+
if ($this->classMap) {
|
94 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
95 |
+
} else {
|
96 |
+
$this->classMap = $classMap;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
102 |
+
* appending or prepending to the ones previously set for this prefix.
|
103 |
+
*
|
104 |
+
* @param string $prefix The prefix
|
105 |
+
* @param array|string $paths The PSR-0 root directories
|
106 |
+
* @param bool $prepend Whether to prepend the directories
|
107 |
+
*/
|
108 |
+
public function add($prefix, $paths, $prepend = false)
|
109 |
+
{
|
110 |
+
if (!$prefix) {
|
111 |
+
if ($prepend) {
|
112 |
+
$this->fallbackDirsPsr0 = array_merge(
|
113 |
+
(array) $paths,
|
114 |
+
$this->fallbackDirsPsr0
|
115 |
+
);
|
116 |
+
} else {
|
117 |
+
$this->fallbackDirsPsr0 = array_merge(
|
118 |
+
$this->fallbackDirsPsr0,
|
119 |
+
(array) $paths
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$first = $prefix[0];
|
127 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
128 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
129 |
+
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
if ($prepend) {
|
133 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
134 |
+
(array) $paths,
|
135 |
+
$this->prefixesPsr0[$first][$prefix]
|
136 |
+
);
|
137 |
+
} else {
|
138 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
139 |
+
$this->prefixesPsr0[$first][$prefix],
|
140 |
+
(array) $paths
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
147 |
+
* appending or prepending to the ones previously set for this namespace.
|
148 |
+
*
|
149 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
150 |
+
* @param array|string $paths The PSR-4 base directories
|
151 |
+
* @param bool $prepend Whether to prepend the directories
|
152 |
+
*
|
153 |
+
* @throws \InvalidArgumentException
|
154 |
+
*/
|
155 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
156 |
+
{
|
157 |
+
if (!$prefix) {
|
158 |
+
// Register directories for the root namespace.
|
159 |
+
if ($prepend) {
|
160 |
+
$this->fallbackDirsPsr4 = array_merge(
|
161 |
+
(array) $paths,
|
162 |
+
$this->fallbackDirsPsr4
|
163 |
+
);
|
164 |
+
} else {
|
165 |
+
$this->fallbackDirsPsr4 = array_merge(
|
166 |
+
$this->fallbackDirsPsr4,
|
167 |
+
(array) $paths
|
168 |
+
);
|
169 |
+
}
|
170 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
171 |
+
// Register directories for a new namespace.
|
172 |
+
$length = strlen($prefix);
|
173 |
+
if ('\\' !== $prefix[$length - 1]) {
|
174 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
175 |
+
}
|
176 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
177 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
178 |
+
} elseif ($prepend) {
|
179 |
+
// Prepend directories for an already registered namespace.
|
180 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
181 |
+
(array) $paths,
|
182 |
+
$this->prefixDirsPsr4[$prefix]
|
183 |
+
);
|
184 |
+
} else {
|
185 |
+
// Append directories for an already registered namespace.
|
186 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
187 |
+
$this->prefixDirsPsr4[$prefix],
|
188 |
+
(array) $paths
|
189 |
+
);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
195 |
+
* replacing any others previously set for this prefix.
|
196 |
+
*
|
197 |
+
* @param string $prefix The prefix
|
198 |
+
* @param array|string $paths The PSR-0 base directories
|
199 |
+
*/
|
200 |
+
public function set($prefix, $paths)
|
201 |
+
{
|
202 |
+
if (!$prefix) {
|
203 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
204 |
+
} else {
|
205 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
211 |
+
* replacing any others previously set for this namespace.
|
212 |
+
*
|
213 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
214 |
+
* @param array|string $paths The PSR-4 base directories
|
215 |
+
*
|
216 |
+
* @throws \InvalidArgumentException
|
217 |
+
*/
|
218 |
+
public function setPsr4($prefix, $paths)
|
219 |
+
{
|
220 |
+
if (!$prefix) {
|
221 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
222 |
+
} else {
|
223 |
+
$length = strlen($prefix);
|
224 |
+
if ('\\' !== $prefix[$length - 1]) {
|
225 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
226 |
+
}
|
227 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
228 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Turns on searching the include path for class files.
|
234 |
+
*
|
235 |
+
* @param bool $useIncludePath
|
236 |
+
*/
|
237 |
+
public function setUseIncludePath($useIncludePath)
|
238 |
+
{
|
239 |
+
$this->useIncludePath = $useIncludePath;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Can be used to check if the autoloader uses the include path to check
|
244 |
+
* for classes.
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
public function getUseIncludePath()
|
249 |
+
{
|
250 |
+
return $this->useIncludePath;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Turns off searching the prefix and fallback directories for classes
|
255 |
+
* that have not been registered with the class map.
|
256 |
+
*
|
257 |
+
* @param bool $classMapAuthoritative
|
258 |
+
*/
|
259 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
260 |
+
{
|
261 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Should class lookup fail if not found in the current class map?
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function isClassMapAuthoritative()
|
270 |
+
{
|
271 |
+
return $this->classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Registers this instance as an autoloader.
|
276 |
+
*
|
277 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
278 |
+
*/
|
279 |
+
public function register($prepend = false)
|
280 |
+
{
|
281 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Unregisters this instance as an autoloader.
|
286 |
+
*/
|
287 |
+
public function unregister()
|
288 |
+
{
|
289 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Loads the given class or interface.
|
294 |
+
*
|
295 |
+
* @param string $class The name of the class
|
296 |
+
* @return bool|null True if loaded, null otherwise
|
297 |
+
*/
|
298 |
+
public function loadClass($class)
|
299 |
+
{
|
300 |
+
if ($file = $this->findFile($class)) {
|
301 |
+
includeFile($file);
|
302 |
+
|
303 |
+
return true;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Finds the path to the file where the class is defined.
|
309 |
+
*
|
310 |
+
* @param string $class The name of the class
|
311 |
+
*
|
312 |
+
* @return string|false The path if found, false otherwise
|
313 |
+
*/
|
314 |
+
public function findFile($class)
|
315 |
+
{
|
316 |
+
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
317 |
+
if ('\\' == $class[0]) {
|
318 |
+
$class = substr($class, 1);
|
319 |
+
}
|
320 |
+
|
321 |
+
// class map lookup
|
322 |
+
if (isset($this->classMap[$class])) {
|
323 |
+
return $this->classMap[$class];
|
324 |
+
}
|
325 |
+
if ($this->classMapAuthoritative) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
+
|
329 |
+
$file = $this->findFileWithExtension($class, '.php');
|
330 |
+
|
331 |
+
// Search for Hack files if we are running on HHVM
|
332 |
+
if ($file === null && defined('HHVM_VERSION')) {
|
333 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
334 |
+
}
|
335 |
+
|
336 |
+
if ($file === null) {
|
337 |
+
// Remember that this class does not exist.
|
338 |
+
return $this->classMap[$class] = false;
|
339 |
+
}
|
340 |
+
|
341 |
+
return $file;
|
342 |
+
}
|
343 |
+
|
344 |
+
private function findFileWithExtension($class, $ext)
|
345 |
+
{
|
346 |
+
// PSR-4 lookup
|
347 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
348 |
+
|
349 |
+
$first = $class[0];
|
350 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
351 |
+
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
+
if (0 === strpos($class, $prefix)) {
|
353 |
+
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
+
return $file;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
// PSR-4 fallback dirs
|
363 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
+
return $file;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
// PSR-0 lookup
|
370 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
371 |
+
// namespaced class name
|
372 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
373 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
374 |
+
} else {
|
375 |
+
// PEAR-like class name
|
376 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (isset($this->prefixesPsr0[$first])) {
|
380 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
+
if (0 === strpos($class, $prefix)) {
|
382 |
+
foreach ($dirs as $dir) {
|
383 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
+
return $file;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
// PSR-0 fallback dirs
|
392 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
+
return $file;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// PSR-0 include paths.
|
399 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
400 |
+
return $file;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Scope isolated include.
|
407 |
+
*
|
408 |
+
* Prevents access to $this/self from included files.
|
409 |
+
*/
|
410 |
+
function includeFile($file)
|
411 |
+
{
|
412 |
+
include $file;
|
413 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/composer/LICENSE
ADDED
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
2 |
+
Upstream-Name: Composer
|
3 |
+
Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
|
4 |
+
Source: https://github.com/composer/composer
|
5 |
+
|
6 |
+
Files: *
|
7 |
+
Copyright: 2016, Nils Adermann <naderman@naderman.de>
|
8 |
+
2016, Jordi Boggiano <j.boggiano@seld.be>
|
9 |
+
License: Expat
|
10 |
+
|
11 |
+
Files: res/cacert.pem
|
12 |
+
Copyright: 2015, Mozilla Foundation
|
13 |
+
License: MPL-2.0
|
14 |
+
|
15 |
+
Files: src/Composer/Util/RemoteFilesystem.php
|
16 |
+
src/Composer/Util/TlsHelper.php
|
17 |
+
Copyright: 2016, Nils Adermann <naderman@naderman.de>
|
18 |
+
2016, Jordi Boggiano <j.boggiano@seld.be>
|
19 |
+
2013, Evan Coury <me@evancoury.com>
|
20 |
+
License: Expat and BSD-2-Clause
|
21 |
+
|
22 |
+
License: BSD-2-Clause
|
23 |
+
Redistribution and use in source and binary forms, with or without modification,
|
24 |
+
are permitted provided that the following conditions are met:
|
25 |
+
.
|
26 |
+
* Redistributions of source code must retain the above copyright notice,
|
27 |
+
this list of conditions and the following disclaimer.
|
28 |
+
.
|
29 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
30 |
+
this list of conditions and the following disclaimer in the documentation
|
31 |
+
and/or other materials provided with the distribution.
|
32 |
+
.
|
33 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
34 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
35 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
36 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
37 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
38 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
39 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
40 |
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
41 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
42 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
43 |
+
|
44 |
+
License: Expat
|
45 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
46 |
+
of this software and associated documentation files (the "Software"), to deal
|
47 |
+
in the Software without restriction, including without limitation the rights
|
48 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
49 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
50 |
+
to do so, subject to the following conditions:
|
51 |
+
.
|
52 |
+
The above copyright notice and this permission notice shall be included in all
|
53 |
+
copies or substantial portions of the Software.
|
54 |
+
.
|
55 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
56 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
57 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
58 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
59 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
60 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
61 |
+
THE SOFTWARE.
|
62 |
+
|
63 |
+
License: MPL-2.0
|
64 |
+
1. Definitions
|
65 |
+
--------------
|
66 |
+
.
|
67 |
+
1.1. "Contributor"
|
68 |
+
means each individual or legal entity that creates, contributes to
|
69 |
+
the creation of, or owns Covered Software.
|
70 |
+
.
|
71 |
+
1.2. "Contributor Version"
|
72 |
+
means the combination of the Contributions of others (if any) used
|
73 |
+
by a Contributor and that particular Contributor's Contribution.
|
74 |
+
.
|
75 |
+
1.3. "Contribution"
|
76 |
+
means Covered Software of a particular Contributor.
|
77 |
+
.
|
78 |
+
1.4. "Covered Software"
|
79 |
+
means Source Code Form to which the initial Contributor has attached
|
80 |
+
the notice in Exhibit A, the Executable Form of such Source Code
|
81 |
+
Form, and Modifications of such Source Code Form, in each case
|
82 |
+
including portions thereof.
|
83 |
+
.
|
84 |
+
1.5. "Incompatible With Secondary Licenses"
|
85 |
+
means
|
86 |
+
.
|
87 |
+
(a) that the initial Contributor has attached the notice described
|
88 |
+
in Exhibit B to the Covered Software; or
|
89 |
+
.
|
90 |
+
(b) that the Covered Software was made available under the terms of
|
91 |
+
version 1.1 or earlier of the License, but not also under the
|
92 |
+
terms of a Secondary License.
|
93 |
+
.
|
94 |
+
1.6. "Executable Form"
|
95 |
+
means any form of the work other than Source Code Form.
|
96 |
+
.
|
97 |
+
1.7. "Larger Work"
|
98 |
+
means a work that combines Covered Software with other material, in
|
99 |
+
a separate file or files, that is not Covered Software.
|
100 |
+
.
|
101 |
+
1.8. "License"
|
102 |
+
means this document.
|
103 |
+
.
|
104 |
+
1.9. "Licensable"
|
105 |
+
means having the right to grant, to the maximum extent possible,
|
106 |
+
whether at the time of the initial grant or subsequently, any and
|
107 |
+
all of the rights conveyed by this License.
|
108 |
+
.
|
109 |
+
1.10. "Modifications"
|
110 |
+
means any of the following:
|
111 |
+
.
|
112 |
+
(a) any file in Source Code Form that results from an addition to,
|
113 |
+
deletion from, or modification of the contents of Covered
|
114 |
+
Software; or
|
115 |
+
.
|
116 |
+
(b) any new file in Source Code Form that contains any Covered
|
117 |
+
Software.
|
118 |
+
.
|
119 |
+
1.11. "Patent Claims" of a Contributor
|
120 |
+
means any patent claim(s), including without limitation, method,
|
121 |
+
process, and apparatus claims, in any patent Licensable by such
|
122 |
+
Contributor that would be infringed, but for the grant of the
|
123 |
+
License, by the making, using, selling, offering for sale, having
|
124 |
+
made, import, or transfer of either its Contributions or its
|
125 |
+
Contributor Version.
|
126 |
+
.
|
127 |
+
1.12. "Secondary License"
|
128 |
+
means either the GNU General Public License, Version 2.0, the GNU
|
129 |
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
130 |
+
Public License, Version 3.0, or any later versions of those
|
131 |
+
licenses.
|
132 |
+
.
|
133 |
+
1.13. "Source Code Form"
|
134 |
+
means the form of the work preferred for making modifications.
|
135 |
+
.
|
136 |
+
1.14. "You" (or "Your")
|
137 |
+
means an individual or a legal entity exercising rights under this
|
138 |
+
License. For legal entities, "You" includes any entity that
|
139 |
+
controls, is controlled by, or is under common control with You. For
|
140 |
+
purposes of this definition, "control" means (a) the power, direct
|
141 |
+
or indirect, to cause the direction or management of such entity,
|
142 |
+
whether by contract or otherwise, or (b) ownership of more than
|
143 |
+
fifty percent (50%) of the outstanding shares or beneficial
|
144 |
+
ownership of such entity.
|
145 |
+
.
|
146 |
+
2. License Grants and Conditions
|
147 |
+
--------------------------------
|
148 |
+
.
|
149 |
+
2.1. Grants
|
150 |
+
.
|
151 |
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
152 |
+
non-exclusive license:
|
153 |
+
.
|
154 |
+
(a) under intellectual property rights (other than patent or trademark)
|
155 |
+
Licensable by such Contributor to use, reproduce, make available,
|
156 |
+
modify, display, perform, distribute, and otherwise exploit its
|
157 |
+
Contributions, either on an unmodified basis, with Modifications, or
|
158 |
+
as part of a Larger Work; and
|
159 |
+
.
|
160 |
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
161 |
+
for sale, have made, import, and otherwise transfer either its
|
162 |
+
Contributions or its Contributor Version.
|
163 |
+
.
|
164 |
+
2.2. Effective Date
|
165 |
+
.
|
166 |
+
The licenses granted in Section 2.1 with respect to any Contribution
|
167 |
+
become effective for each Contribution on the date the Contributor first
|
168 |
+
distributes such Contribution.
|
169 |
+
.
|
170 |
+
2.3. Limitations on Grant Scope
|
171 |
+
.
|
172 |
+
The licenses granted in this Section 2 are the only rights granted under
|
173 |
+
this License. No additional rights or licenses will be implied from the
|
174 |
+
distribution or licensing of Covered Software under this License.
|
175 |
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
176 |
+
Contributor:
|
177 |
+
.
|
178 |
+
(a) for any code that a Contributor has removed from Covered Software;
|
179 |
+
or
|
180 |
+
.
|
181 |
+
(b) for infringements caused by: (i) Your and any other third party's
|
182 |
+
modifications of Covered Software, or (ii) the combination of its
|
183 |
+
Contributions with other software (except as part of its Contributor
|
184 |
+
Version); or
|
185 |
+
.
|
186 |
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
187 |
+
its Contributions.
|
188 |
+
.
|
189 |
+
This License does not grant any rights in the trademarks, service marks,
|
190 |
+
or logos of any Contributor (except as may be necessary to comply with
|
191 |
+
the notice requirements in Section 3.4).
|
192 |
+
.
|
193 |
+
2.4. Subsequent Licenses
|
194 |
+
.
|
195 |
+
No Contributor makes additional grants as a result of Your choice to
|
196 |
+
distribute the Covered Software under a subsequent version of this
|
197 |
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
198 |
+
permitted under the terms of Section 3.3).
|
199 |
+
.
|
200 |
+
2.5. Representation
|
201 |
+
.
|
202 |
+
Each Contributor represents that the Contributor believes its
|
203 |
+
Contributions are its original creation(s) or it has sufficient rights
|
204 |
+
to grant the rights to its Contributions conveyed by this License.
|
205 |
+
.
|
206 |
+
2.6. Fair Use
|
207 |
+
.
|
208 |
+
This License is not intended to limit any rights You have under
|
209 |
+
applicable copyright doctrines of fair use, fair dealing, or other
|
210 |
+
equivalents.
|
211 |
+
.
|
212 |
+
2.7. Conditions
|
213 |
+
.
|
214 |
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
215 |
+
in Section 2.1.
|
216 |
+
.
|
217 |
+
3. Responsibilities
|
218 |
+
-------------------
|
219 |
+
.
|
220 |
+
3.1. Distribution of Source Form
|
221 |
+
.
|
222 |
+
All distribution of Covered Software in Source Code Form, including any
|
223 |
+
Modifications that You create or to which You contribute, must be under
|
224 |
+
the terms of this License. You must inform recipients that the Source
|
225 |
+
Code Form of the Covered Software is governed by the terms of this
|
226 |
+
License, and how they can obtain a copy of this License. You may not
|
227 |
+
attempt to alter or restrict the recipients' rights in the Source Code
|
228 |
+
Form.
|
229 |
+
.
|
230 |
+
3.2. Distribution of Executable Form
|
231 |
+
.
|
232 |
+
If You distribute Covered Software in Executable Form then:
|
233 |
+
.
|
234 |
+
(a) such Covered Software must also be made available in Source Code
|
235 |
+
Form, as described in Section 3.1, and You must inform recipients of
|
236 |
+
the Executable Form how they can obtain a copy of such Source Code
|
237 |
+
Form by reasonable means in a timely manner, at a charge no more
|
238 |
+
than the cost of distribution to the recipient; and
|
239 |
+
.
|
240 |
+
(b) You may distribute such Executable Form under the terms of this
|
241 |
+
License, or sublicense it under different terms, provided that the
|
242 |
+
license for the Executable Form does not attempt to limit or alter
|
243 |
+
the recipients' rights in the Source Code Form under this License.
|
244 |
+
.
|
245 |
+
3.3. Distribution of a Larger Work
|
246 |
+
.
|
247 |
+
You may create and distribute a Larger Work under terms of Your choice,
|
248 |
+
provided that You also comply with the requirements of this License for
|
249 |
+
the Covered Software. If the Larger Work is a combination of Covered
|
250 |
+
Software with a work governed by one or more Secondary Licenses, and the
|
251 |
+
Covered Software is not Incompatible With Secondary Licenses, this
|
252 |
+
License permits You to additionally distribute such Covered Software
|
253 |
+
under the terms of such Secondary License(s), so that the recipient of
|
254 |
+
the Larger Work may, at their option, further distribute the Covered
|
255 |
+
Software under the terms of either this License or such Secondary
|
256 |
+
License(s).
|
257 |
+
.
|
258 |
+
3.4. Notices
|
259 |
+
.
|
260 |
+
You may not remove or alter the substance of any license notices
|
261 |
+
(including copyright notices, patent notices, disclaimers of warranty,
|
262 |
+
or limitations of liability) contained within the Source Code Form of
|
263 |
+
the Covered Software, except that You may alter any license notices to
|
264 |
+
the extent required to remedy known factual inaccuracies.
|
265 |
+
.
|
266 |
+
3.5. Application of Additional Terms
|
267 |
+
.
|
268 |
+
You may choose to offer, and to charge a fee for, warranty, support,
|
269 |
+
indemnity or liability obligations to one or more recipients of Covered
|
270 |
+
Software. However, You may do so only on Your own behalf, and not on
|
271 |
+
behalf of any Contributor. You must make it absolutely clear that any
|
272 |
+
such warranty, support, indemnity, or liability obligation is offered by
|
273 |
+
You alone, and You hereby agree to indemnify every Contributor for any
|
274 |
+
liability incurred by such Contributor as a result of warranty, support,
|
275 |
+
indemnity or liability terms You offer. You may include additional
|
276 |
+
disclaimers of warranty and limitations of liability specific to any
|
277 |
+
jurisdiction.
|
278 |
+
.
|
279 |
+
4. Inability to Comply Due to Statute or Regulation
|
280 |
+
---------------------------------------------------
|
281 |
+
.
|
282 |
+
If it is impossible for You to comply with any of the terms of this
|
283 |
+
License with respect to some or all of the Covered Software due to
|
284 |
+
statute, judicial order, or regulation then You must: (a) comply with
|
285 |
+
the terms of this License to the maximum extent possible; and (b)
|
286 |
+
describe the limitations and the code they affect. Such description must
|
287 |
+
be placed in a text file included with all distributions of the Covered
|
288 |
+
Software under this License. Except to the extent prohibited by statute
|
289 |
+
or regulation, such description must be sufficiently detailed for a
|
290 |
+
recipient of ordinary skill to be able to understand it.
|
291 |
+
.
|
292 |
+
5. Termination
|
293 |
+
--------------
|
294 |
+
.
|
295 |
+
5.1. The rights granted under this License will terminate automatically
|
296 |
+
if You fail to comply with any of its terms. However, if You become
|
297 |
+
compliant, then the rights granted under this License from a particular
|
298 |
+
Contributor are reinstated (a) provisionally, unless and until such
|
299 |
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
300 |
+
ongoing basis, if such Contributor fails to notify You of the
|
301 |
+
non-compliance by some reasonable means prior to 60 days after You have
|
302 |
+
come back into compliance. Moreover, Your grants from a particular
|
303 |
+
Contributor are reinstated on an ongoing basis if such Contributor
|
304 |
+
notifies You of the non-compliance by some reasonable means, this is the
|
305 |
+
first time You have received notice of non-compliance with this License
|
306 |
+
from such Contributor, and You become compliant prior to 30 days after
|
307 |
+
Your receipt of the notice.
|
308 |
+
.
|
309 |
+
5.2. If You initiate litigation against any entity by asserting a patent
|
310 |
+
infringement claim (excluding declaratory judgment actions,
|
311 |
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
312 |
+
directly or indirectly infringes any patent, then the rights granted to
|
313 |
+
You by any and all Contributors for the Covered Software under Section
|
314 |
+
2.1 of this License shall terminate.
|
315 |
+
.
|
316 |
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
317 |
+
end user license agreements (excluding distributors and resellers) which
|
318 |
+
have been validly granted by You or Your distributors under this License
|
319 |
+
prior to termination shall survive termination.
|
320 |
+
.
|
321 |
+
************************************************************************
|
322 |
+
* *
|
323 |
+
* 6. Disclaimer of Warranty *
|
324 |
+
* ------------------------- *
|
325 |
+
* *
|
326 |
+
* Covered Software is provided under this License on an "as is" *
|
327 |
+
* basis, without warranty of any kind, either expressed, implied, or *
|
328 |
+
* statutory, including, without limitation, warranties that the *
|
329 |
+
* Covered Software is free of defects, merchantable, fit for a *
|
330 |
+
* particular purpose or non-infringing. The entire risk as to the *
|
331 |
+
* quality and performance of the Covered Software is with You. *
|
332 |
+
* Should any Covered Software prove defective in any respect, You *
|
333 |
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
334 |
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
335 |
+
* essential part of this License. No use of any Covered Software is *
|
336 |
+
* authorized under this License except under this disclaimer. *
|
337 |
+
* *
|
338 |
+
************************************************************************
|
339 |
+
.
|
340 |
+
************************************************************************
|
341 |
+
* *
|
342 |
+
* 7. Limitation of Liability *
|
343 |
+
* -------------------------- *
|
344 |
+
* *
|
345 |
+
* Under no circumstances and under no legal theory, whether tort *
|
346 |
+
* (including negligence), contract, or otherwise, shall any *
|
347 |
+
* Contributor, or anyone who distributes Covered Software as *
|
348 |
+
* permitted above, be liable to You for any direct, indirect, *
|
349 |
+
* special, incidental, or consequential damages of any character *
|
350 |
+
* including, without limitation, damages for lost profits, loss of *
|
351 |
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
352 |
+
* and all other commercial damages or losses, even if such party *
|
353 |
+
* shall have been informed of the possibility of such damages. This *
|
354 |
+
* limitation of liability shall not apply to liability for death or *
|
355 |
+
* personal injury resulting from such party's negligence to the *
|
356 |
+
* extent applicable law prohibits such limitation. Some *
|
357 |
+
* jurisdictions do not allow the exclusion or limitation of *
|
358 |
+
* incidental or consequential damages, so this exclusion and *
|
359 |
+
* limitation may not apply to You. *
|
360 |
+
* *
|
361 |
+
************************************************************************
|
362 |
+
.
|
363 |
+
8. Litigation
|
364 |
+
-------------
|
365 |
+
.
|
366 |
+
Any litigation relating to this License may be brought only in the
|
367 |
+
courts of a jurisdiction where the defendant maintains its principal
|
368 |
+
place of business and such litigation shall be governed by laws of that
|
369 |
+
jurisdiction, without reference to its conflict-of-law provisions.
|
370 |
+
Nothing in this Section shall prevent a party's ability to bring
|
371 |
+
cross-claims or counter-claims.
|
372 |
+
.
|
373 |
+
9. Miscellaneous
|
374 |
+
----------------
|
375 |
+
.
|
376 |
+
This License represents the complete agreement concerning the subject
|
377 |
+
matter hereof. If any provision of this License is held to be
|
378 |
+
unenforceable, such provision shall be reformed only to the extent
|
379 |
+
necessary to make it enforceable. Any law or regulation which provides
|
380 |
+
that the language of a contract shall be construed against the drafter
|
381 |
+
shall not be used to construe this License against a Contributor.
|
382 |
+
.
|
383 |
+
10. Versions of the License
|
384 |
+
---------------------------
|
385 |
+
.
|
386 |
+
10.1. New Versions
|
387 |
+
.
|
388 |
+
Mozilla Foundation is the license steward. Except as provided in Section
|
389 |
+
10.3, no one other than the license steward has the right to modify or
|
390 |
+
publish new versions of this License. Each version will be given a
|
391 |
+
distinguishing version number.
|
392 |
+
.
|
393 |
+
10.2. Effect of New Versions
|
394 |
+
.
|
395 |
+
You may distribute the Covered Software under the terms of the version
|
396 |
+
of the License under which You originally received the Covered Software,
|
397 |
+
or under the terms of any subsequent version published by the license
|
398 |
+
steward.
|
399 |
+
.
|
400 |
+
10.3. Modified Versions
|
401 |
+
.
|
402 |
+
If you create software not governed by this License, and you want to
|
403 |
+
create a new license for such software, you may create and use a
|
404 |
+
modified version of this License if you rename the license and remove
|
405 |
+
any references to the name of the license steward (except to note that
|
406 |
+
such modified license differs from this License).
|
407 |
+
.
|
408 |
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
409 |
+
Licenses
|
410 |
+
.
|
411 |
+
If You choose to distribute Source Code Form that is Incompatible With
|
412 |
+
Secondary Licenses under the terms of this version of the License, the
|
413 |
+
notice described in Exhibit B of this License must be attached.
|
414 |
+
.
|
415 |
+
Exhibit A - Source Code Form License Notice
|
416 |
+
-------------------------------------------
|
417 |
+
.
|
418 |
+
This Source Code Form is subject to the terms of the Mozilla Public
|
419 |
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
420 |
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
421 |
+
.
|
422 |
+
If it is not possible or desirable to put the notice in a particular
|
423 |
+
file, then You may include the notice in a location (such as a LICENSE
|
424 |
+
file in a relevant directory) where a recipient would be likely to look
|
425 |
+
for such a notice.
|
426 |
+
.
|
427 |
+
You may add additional accurate notices of copyright ownership.
|
428 |
+
.
|
429 |
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
430 |
+
---------------------------------------------------------
|
431 |
+
.
|
432 |
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
433 |
+
defined by the Mozilla Public License, v. 2.0.
|
Postman/Postman-Mail/sendgrid/vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_files.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'3f8bdd3b35094c73a26f0106e3c0f8b2' => $vendorDir . '/sendgrid/sendgrid/lib/SendGrid.php',
|
10 |
+
);
|
Postman/Postman-Mail/sendgrid/vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'SendGrid\\Stats\\' => array($vendorDir . '/sendgrid/sendgrid/lib/stats'),
|
10 |
+
'SendGrid\\Mail\\' => array($vendorDir . '/sendgrid/sendgrid/lib/mail'),
|
11 |
+
'SendGrid\\Contacts\\' => array($vendorDir . '/sendgrid/sendgrid/lib/contacts'),
|
12 |
+
'SendGrid\\' => array($vendorDir . '/sendgrid/php-http-client/lib', $vendorDir . '/sendgrid/sendgrid/lib'),
|
13 |
+
);
|
Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
+
foreach ($map as $namespace => $path) {
|
28 |
+
$loader->set($namespace, $path);
|
29 |
+
}
|
30 |
+
|
31 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
32 |
+
foreach ($map as $namespace => $path) {
|
33 |
+
$loader->setPsr4($namespace, $path);
|
34 |
+
}
|
35 |
+
|
36 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
37 |
+
if ($classMap) {
|
38 |
+
$loader->addClassMap($classMap);
|
39 |
+
}
|
40 |
+
|
41 |
+
$loader->register(true);
|
42 |
+
|
43 |
+
$includeFiles = require __DIR__ . '/autoload_files.php';
|
44 |
+
foreach ($includeFiles as $fileIdentifier => $file) {
|
45 |
+
composerRequireb8261ccd2bb9e98223bcd166b46db8d9($fileIdentifier, $file);
|
46 |
+
}
|
47 |
+
|
48 |
+
return $loader;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
function composerRequireb8261ccd2bb9e98223bcd166b46db8d9($fileIdentifier, $file)
|
53 |
+
{
|
54 |
+
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
55 |
+
require $file;
|
56 |
+
|
57 |
+
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
58 |
+
}
|
59 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/composer/installed.json
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "sendgrid/php-http-client",
|
4 |
+
"version": "3.9.6",
|
5 |
+
"version_normalized": "3.9.6.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/sendgrid/php-http-client.git",
|
9 |
+
"reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/e9a04d949ee2d19938ab83dc100933a3b41a8ec7",
|
14 |
+
"reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.6"
|
19 |
+
},
|
20 |
+
"require-dev": {
|
21 |
+
"phpunit/phpunit": "~4.4",
|
22 |
+
"squizlabs/php_codesniffer": "~2.0"
|
23 |
+
},
|
24 |
+
"time": "2018-04-10 18:06:08",
|
25 |
+
"type": "library",
|
26 |
+
"installation-source": "dist",
|
27 |
+
"autoload": {
|
28 |
+
"psr-4": {
|
29 |
+
"SendGrid\\": "lib/"
|
30 |
+
}
|
31 |
+
},
|
32 |
+
"notification-url": "https://packagist.org/downloads/",
|
33 |
+
"license": [
|
34 |
+
"MIT"
|
35 |
+
],
|
36 |
+
"authors": [
|
37 |
+
{
|
38 |
+
"name": "Matt Bernier",
|
39 |
+
"email": "dx@sendgrid.com"
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"name": "Elmer Thomas",
|
43 |
+
"email": "elmer@thinkingserious.com"
|
44 |
+
}
|
45 |
+
],
|
46 |
+
"description": "HTTP REST client, simplified for PHP",
|
47 |
+
"homepage": "http://github.com/sendgrid/php-http-client",
|
48 |
+
"keywords": [
|
49 |
+
"api",
|
50 |
+
"fluent",
|
51 |
+
"http",
|
52 |
+
"rest",
|
53 |
+
"sendgrid"
|
54 |
+
]
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"name": "sendgrid/sendgrid",
|
58 |
+
"version": "7.3.0",
|
59 |
+
"version_normalized": "7.3.0.0",
|
60 |
+
"source": {
|
61 |
+
"type": "git",
|
62 |
+
"url": "https://github.com/sendgrid/sendgrid-php.git",
|
63 |
+
"reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d"
|
64 |
+
},
|
65 |
+
"dist": {
|
66 |
+
"type": "zip",
|
67 |
+
"url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/37fa19d3ae019842f07a2a43e92ed0f566ad927d",
|
68 |
+
"reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d",
|
69 |
+
"shasum": ""
|
70 |
+
},
|
71 |
+
"require": {
|
72 |
+
"ext-curl": "*",
|
73 |
+
"ext-json": "*",
|
74 |
+
"ext-mbstring": "*",
|
75 |
+
"ext-openssl": "*",
|
76 |
+
"php": ">=5.6",
|
77 |
+
"sendgrid/php-http-client": "~3.9"
|
78 |
+
},
|
79 |
+
"replace": {
|
80 |
+
"sendgrid/sendgrid-php": "*"
|
81 |
+
},
|
82 |
+
"require-dev": {
|
83 |
+
"phpunit/phpunit": "^5.7.9 || ^6.4.3",
|
84 |
+
"squizlabs/php_codesniffer": "3.*",
|
85 |
+
"swaggest/json-diff": "^3.4"
|
86 |
+
},
|
87 |
+
"time": "2019-04-15 17:27:21",
|
88 |
+
"type": "library",
|
89 |
+
"installation-source": "dist",
|
90 |
+
"autoload": {
|
91 |
+
"psr-4": {
|
92 |
+
"SendGrid\\": "lib/",
|
93 |
+
"SendGrid\\Mail\\": "lib/mail/",
|
94 |
+
"SendGrid\\Contacts\\": "lib/contacts/",
|
95 |
+
"SendGrid\\Stats\\": "lib/stats/"
|
96 |
+
},
|
97 |
+
"files": [
|
98 |
+
"lib/SendGrid.php"
|
99 |
+
]
|
100 |
+
},
|
101 |
+
"notification-url": "https://packagist.org/downloads/",
|
102 |
+
"license": [
|
103 |
+
"MIT"
|
104 |
+
],
|
105 |
+
"description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.",
|
106 |
+
"homepage": "http://github.com/sendgrid/sendgrid-php",
|
107 |
+
"keywords": [
|
108 |
+
"email",
|
109 |
+
"grid",
|
110 |
+
"send",
|
111 |
+
"sendgrid",
|
112 |
+
"twilio sendgrid"
|
113 |
+
]
|
114 |
+
}
|
115 |
+
]
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.codeclimate.yml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
engines:
|
2 |
+
duplication:
|
3 |
+
enabled: true
|
4 |
+
config:
|
5 |
+
languages:
|
6 |
+
- "php"
|
7 |
+
phpcodesniffer:
|
8 |
+
enabled: true
|
9 |
+
config:
|
10 |
+
file_extensions: "php"
|
11 |
+
standard: "PSR1,PSR2"
|
12 |
+
ratings:
|
13 |
+
paths:
|
14 |
+
- "**.php"
|
15 |
+
exclude_paths:
|
16 |
+
- "examples/**/*"
|
17 |
+
- "test/**/*"
|
18 |
+
- "vendor/**/*"
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#### Issue Summary
|
2 |
+
|
3 |
+
A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
|
4 |
+
|
5 |
+
|
6 |
+
#### Steps to Reproduce
|
7 |
+
|
8 |
+
1. This is the first step
|
9 |
+
2. This is the second step
|
10 |
+
3. Further steps, etc.
|
11 |
+
|
12 |
+
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
|
13 |
+
|
14 |
+
#### Technical details:
|
15 |
+
|
16 |
+
* php-http-client Version: master (latest commit: [commit number])
|
17 |
+
* PHP Version: X.X
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/PULL_REQUEST_TEMPLATE
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.
|
3 |
+
|
4 |
+
|
5 |
+
Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
|
6 |
+
e.g.
|
7 |
+
Fixes #1
|
8 |
+
Closes #2
|
9 |
+
-->
|
10 |
+
# Fixes #
|
11 |
+
|
12 |
+
### Checklist
|
13 |
+
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
|
14 |
+
- [ ] I have read the [Contribution Guide] and my PR follows them.
|
15 |
+
- [ ] I updated my branch with the master branch.
|
16 |
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
17 |
+
- [ ] I have added necessary documentation about the functionality in the appropriate .md file
|
18 |
+
- [ ] I have added in line documentation to the code I modified
|
19 |
+
|
20 |
+
### Short description of what this PR does:
|
21 |
+
-
|
22 |
+
-
|
23 |
+
|
24 |
+
If you have questions, please send an email to [Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
before_script:
|
3 |
+
- composer install --dev --no-interaction
|
4 |
+
- cd test/unit
|
5 |
+
script:
|
6 |
+
- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover=coverage.xml
|
7 |
+
after_success:
|
8 |
+
- bash <(curl -s https://codecov.io/bash)
|
9 |
+
php:
|
10 |
+
- 5.6
|
11 |
+
- 7.0
|
12 |
+
env:
|
13 |
+
global:
|
14 |
+
- secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4=
|
15 |
+
- secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw=
|
16 |
+
- secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE=
|
17 |
+
- secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw=
|
18 |
+
notifications:
|
19 |
+
hipchat:
|
20 |
+
rooms:
|
21 |
+
secure: EFEaChRQCOLvxAvmxJe357CbfJ/wpW7ddhU0dqUljawSKbdeTkoF0Ja2NbtnIPVpJrqN9qT8BXTK3fmsJ7OJO+QCLi0R2FPnI7r+GpmjFqkxHO0KJ/Oiv1kB9jL1UcKuwhSsPubWPRvt4TKuDhEefuZb1X2xSFZZAzqROrLKtqUmy9vgpRYZtxmGRTGLfLmih8DJP96yvIOE/7/lp8lEdmXw4xF1NZtshnOiOLYrahY4pcOSl3y7eepzaGA33wWS/truH0Rh/IgTOYP2Z/ujIZE9Eg6nSwwOI8U2XzK/BEwEhrHCeyj3oAoBoGbO/m9ydaM6QM8/VT3JdVHPIWFpIhCioClwrIs3m1KsoMVeqEbuWF3h+ju6RMve5fCNvGV8tUyKpZ8GEVlEc7WdwkSKXeINgRLv7AykybZ6EkCRPkQ61/h+cNQlwKqtfeUaoBwjGAnfMQMQX5qApUn/ow8TbULnveqswhkV1fBsydiPBJxdlDe8x54GclCmgU5wnd283THUecP+8dznU+xVgfHqBnf2k9wirSEnYXh2T228kYUmEWKfhRq/7e86K2DAQAO5Vw/6HgL7e1ZVDccH6hx3lTGyjlUskkZvzktwi6gZ9gxOihQ8Yzkc1IQANr8ckQJvOZjMTQxJqgFWgXJWgRxWlpPiISLauaegcH2eNwGPRmY=
|
22 |
+
template:
|
23 |
+
- '<a href="https://travis-ci.org/%{repository}/builds/%{build_id}">%{repository}
|
24 |
+
Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong>
|
25 |
+
<a href="https://github.com/%{repository}/commits/%{commit}">View on GitHub</a>'
|
26 |
+
format: html
|
27 |
+
notify: true
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
|
2 |
+
|
3 |
+
- [CLAs and CCLAs](#cla)
|
4 |
+
- [Roadmap & Milestones](#roadmap)
|
5 |
+
- [Feature Request](#feature-request)
|
6 |
+
- [Submit a Bug Report](#submit-a-bug-report)
|
7 |
+
- [Improvements to the Codebase](#improvements-to-the-codebase)
|
8 |
+
- [Understanding the Code Base](#understanding-the-codebase)
|
9 |
+
- [Testing](#testing)
|
10 |
+
- [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions)
|
11 |
+
- [Creating a Pull Request](#creating-a-pull-request)
|
12 |
+
- [Code Reviews](#code-reviews)
|
13 |
+
|
14 |
+
<a name="roadmap"></a>
|
15 |
+
We use [Milestones](https://github.com/sendgrid/php-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
|
16 |
+
|
17 |
+
<a name="cla"></a>
|
18 |
+
## CLAs and CCLAs
|
19 |
+
|
20 |
+
Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project.
|
21 |
+
|
22 |
+
Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
|
23 |
+
|
24 |
+
SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla).
|
25 |
+
|
26 |
+
When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change.
|
27 |
+
|
28 |
+
There are a few ways to contribute, which we'll enumerate below:
|
29 |
+
|
30 |
+
<a name="feature-request"></a>
|
31 |
+
## Feature Request
|
32 |
+
|
33 |
+
If you'd like to make a feature request, please read this section.
|
34 |
+
|
35 |
+
The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
|
36 |
+
|
37 |
+
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
|
38 |
+
- Please be respectful and considerate of others when commenting on issues
|
39 |
+
|
40 |
+
<a name="submit-a-bug-report"></a>
|
41 |
+
## Submit a Bug Report
|
42 |
+
|
43 |
+
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
|
44 |
+
|
45 |
+
A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
|
46 |
+
|
47 |
+
Before you decide to create a new issue, please try the following:
|
48 |
+
|
49 |
+
1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
|
50 |
+
2. Update to the latest version of this code and check if issue has already been fixed
|
51 |
+
3. Copy and fill in the Bug Report Template we have provided below
|
52 |
+
|
53 |
+
### Please use our Bug Report Template
|
54 |
+
|
55 |
+
In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/php-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
|
56 |
+
|
57 |
+
<a name="improvements-to-the-codebase"></a>
|
58 |
+
## Improvements to the Codebase
|
59 |
+
|
60 |
+
We welcome direct contributions to the php-http-client code base. Thank you!
|
61 |
+
|
62 |
+
### Development Environment ###
|
63 |
+
|
64 |
+
#### Install and Run Locally ####
|
65 |
+
|
66 |
+
##### Prerequisites #####
|
67 |
+
|
68 |
+
- PHP 5.6 or 7.0
|
69 |
+
- [Composer](https://getcomposer.org/)
|
70 |
+
|
71 |
+
##### Initial setup: #####
|
72 |
+
|
73 |
+
```bash
|
74 |
+
git clone https://github.com/sendgrid/php-http-client.git
|
75 |
+
cd php-http-client
|
76 |
+
```
|
77 |
+
|
78 |
+
### Environment Variables
|
79 |
+
|
80 |
+
First, get your free SendGrid account [here](https://sendgrid.com/free?source=php-http-client).
|
81 |
+
|
82 |
+
Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
|
83 |
+
|
84 |
+
```bash
|
85 |
+
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
|
86 |
+
echo "sendgrid.env" >> .gitignore
|
87 |
+
source ./sendgrid.env
|
88 |
+
```
|
89 |
+
|
90 |
+
##### Execute: #####
|
91 |
+
|
92 |
+
See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples).
|
93 |
+
|
94 |
+
<a name="understanding-the-codebase"></a>
|
95 |
+
## Understanding the Code Base
|
96 |
+
|
97 |
+
**/examples**
|
98 |
+
|
99 |
+
Working examples that demonstrate usage.
|
100 |
+
|
101 |
+
**/test/unit**
|
102 |
+
|
103 |
+
Unit tests.
|
104 |
+
|
105 |
+
**/lib/SendGrid/Client.php**
|
106 |
+
|
107 |
+
An HTTP client with a fluent interface using method chaining and reflection. By returning self on [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) and [_()](https://github.com/sendgrid/php-http-client/blob/master/lib/client.pph#L198), we can dynamically build the URL using method chaining and [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) allows us to dynamically receive the method calls to achieve reflection.
|
108 |
+
|
109 |
+
This allows for the following mapping from a URL to a method chain:
|
110 |
+
|
111 |
+
`/api_client/{api_key_id}/version` maps to `client->api_client().->_($api_key_id)->version-><method>()` where <method> is a [HTTP verb](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L94).
|
112 |
+
|
113 |
+
**/lib/SendGrid/Config.php**
|
114 |
+
|
115 |
+
Loads the environment variables.
|
116 |
+
|
117 |
+
<a name="testing"></a>
|
118 |
+
## Testing
|
119 |
+
|
120 |
+
All PRs require passing tests before the PR will be reviewed.
|
121 |
+
|
122 |
+
All test files are in the [`/test/unit`](https://github.com/sendgrid/php-http-client/tree/master/test/unit) directory.
|
123 |
+
|
124 |
+
For the purposes of contributing to this repo, please update the [`ClientTest.php`](https://github.com/sendgrid/php-http-client/blob/master/test/unit/ClientTest.php) file with unit tests as you modify the code.
|
125 |
+
|
126 |
+
```bash
|
127 |
+
composer install
|
128 |
+
cd test/unit
|
129 |
+
../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test*
|
130 |
+
```
|
131 |
+
|
132 |
+
<a name="style-guidelines-and-naming-conventions"></a>
|
133 |
+
## Style Guidelines & Naming Conventions
|
134 |
+
|
135 |
+
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
|
136 |
+
|
137 |
+
- [pear coding standards](https://pear.php.net/manual/en/standards.php)
|
138 |
+
|
139 |
+
Please run your code through:
|
140 |
+
|
141 |
+
- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
|
142 |
+
|
143 |
+
<a name="creating-a-pull-request"></a>
|
144 |
+
## Creating a Pull Request
|
145 |
+
|
146 |
+
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
|
147 |
+
and configure the remotes:
|
148 |
+
|
149 |
+
```bash
|
150 |
+
# Clone your fork of the repo into the current directory
|
151 |
+
git clone https://github.com/sendgrid/php-http-client
|
152 |
+
# Navigate to the newly cloned directory
|
153 |
+
cd php-http-client
|
154 |
+
# Assign the original repo to a remote called "upstream"
|
155 |
+
git remote add upstream https://github.com/sendgrid/php-http-client
|
156 |
+
```
|
157 |
+
|
158 |
+
2. If you cloned a while ago, get the latest changes from upstream:
|
159 |
+
|
160 |
+
```bash
|
161 |
+
git checkout <dev-branch>
|
162 |
+
git pull upstream <dev-branch>
|
163 |
+
```
|
164 |
+
|
165 |
+
3. Create a new topic branch (off the main project development branch) to
|
166 |
+
contain your feature, change, or fix:
|
167 |
+
|
168 |
+
```bash
|
169 |
+
git checkout -b <topic-branch-name>
|
170 |
+
```
|
171 |
+
|
172 |
+
4. Commit your changes in logical chunks. Please adhere to these [git commit
|
173 |
+
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
174 |
+
or your code is unlikely be merged into the main project. Use Git's
|
175 |
+
[interactive rebase](https://help.github.com/articles/interactive-rebase)
|
176 |
+
feature to tidy up your commits before making them public.
|
177 |
+
|
178 |
+
4a. Create tests.
|
179 |
+
|
180 |
+
4b. Create or update the example code that demonstrates the functionality of this change to the code.
|
181 |
+
|
182 |
+
5. Locally merge (or rebase) the upstream development branch into your topic branch:
|
183 |
+
|
184 |
+
```bash
|
185 |
+
git pull [--rebase] upstream master
|
186 |
+
```
|
187 |
+
|
188 |
+
6. Push your topic branch up to your fork:
|
189 |
+
|
190 |
+
```bash
|
191 |
+
git push origin <topic-branch-name>
|
192 |
+
```
|
193 |
+
|
194 |
+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
195 |
+
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
|
196 |
+
|
197 |
+
<a name="code-reviews"></a>
|
198 |
+
## Code Reviews
|
199 |
+
If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, Github has some great [information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/).
|
200 |
+
|
201 |
+
If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM php:7.1-apache
|
2 |
+
|
3 |
+
ARG sendgrid_apikey
|
4 |
+
ENV SENDGRID_API_KEY=$sendgrid_apikey
|
5 |
+
|
6 |
+
COPY . /var/www/client
|
7 |
+
WORKDIR /var/www/client
|
8 |
+
|
9 |
+
RUN apt-get update && \
|
10 |
+
apt-get install -y git zip zlib1g-dev && docker-php-ext-install zip
|
11 |
+
RUN curl --silent --show-error https://getcomposer.org/installer | php
|
12 |
+
|
13 |
+
RUN php composer.phar install
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2012-2018 SendGrid, Inc.
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
22 |
+
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
|
2 |
+
|
3 |
+
[![Travis Badge](https://travis-ci.org/sendgrid/php-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/php-http-client)
|
4 |
+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/sendgrid/php-http-client.svg?style=flat-square)](https://packagist.org/packages/sendgrid/php-http-client)
|
5 |
+
[![Email Notifications Badge](https://dx.sendgrid.com/badge/php)](https://dx.sendgrid.com/newsletter/php)
|
6 |
+
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
|
7 |
+
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/php-http-client.svg)](https://github.com/sendgrid/php-http-client/graphs/contributors)
|
8 |
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
|
9 |
+
|
10 |
+
**Quickly and easily access any RESTful or RESTful-like API.**
|
11 |
+
|
12 |
+
If you are looking for the SendGrid API client library, please see [this repo](https://github.com/sendgrid/sendgrid-php).
|
13 |
+
|
14 |
+
# Announcements
|
15 |
+
|
16 |
+
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/php-http-client/blob/master/CHANGELOG.md).
|
17 |
+
|
18 |
+
# Table of Contents
|
19 |
+
- [Installation](#installation)
|
20 |
+
- [Quick Start](#quick-start)
|
21 |
+
- [Usage](#usage)
|
22 |
+
- [Roadmap](#roadmap)
|
23 |
+
- [How to Contribute](#contribute)
|
24 |
+
- [Thanks](#thanks)
|
25 |
+
- [About](#about)
|
26 |
+
- [License](#license)
|
27 |
+
|
28 |
+
<a name="installation"></a>
|
29 |
+
# Installation
|
30 |
+
|
31 |
+
## Prerequisites
|
32 |
+
|
33 |
+
- PHP version 5.6 or 7.0
|
34 |
+
|
35 |
+
## Install with Composer
|
36 |
+
|
37 |
+
Add php-http-client to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.
|
38 |
+
|
39 |
+
```json
|
40 |
+
{
|
41 |
+
"require": {
|
42 |
+
"sendgrid/php-http-client": "~3.9.6"
|
43 |
+
}
|
44 |
+
}
|
45 |
+
```
|
46 |
+
|
47 |
+
Then at the top of your PHP script require the autoloader:
|
48 |
+
|
49 |
+
```php
|
50 |
+
require __DIR__ . '/vendor/autoload.php';
|
51 |
+
```
|
52 |
+
|
53 |
+
Then from the command line:
|
54 |
+
|
55 |
+
```bash
|
56 |
+
composer install
|
57 |
+
```
|
58 |
+
|
59 |
+
## Install without Composer
|
60 |
+
|
61 |
+
You should create directory `lib` in directory of your application and clone to `lib` repositories [php-http-client](https://github.com/sendgrid/php-http-client.git) and [sendgrid-php](https://github.com/sendgrid/sendgrid-php.git):
|
62 |
+
|
63 |
+
```
|
64 |
+
$ cd /path/to/your/app
|
65 |
+
$ mkdir lib
|
66 |
+
$ cd lib
|
67 |
+
$ git clone https://github.com/sendgrid/php-http-client.git
|
68 |
+
```
|
69 |
+
|
70 |
+
In the next step you should create `loader.php`:
|
71 |
+
|
72 |
+
```
|
73 |
+
$ cd /path/to/your/app
|
74 |
+
$ touch loader.php
|
75 |
+
```
|
76 |
+
|
77 |
+
And add to `loader.php` code below:
|
78 |
+
|
79 |
+
```php
|
80 |
+
<?php
|
81 |
+
|
82 |
+
require_once __DIR__ . '/lib/php-http-client/lib/Client.php';
|
83 |
+
require_once __DIR__ . '/lib/php-http-client/lib/Response.php';
|
84 |
+
```
|
85 |
+
|
86 |
+
After it you can use `php-http-client` library in your project:
|
87 |
+
|
88 |
+
```php
|
89 |
+
<?php
|
90 |
+
|
91 |
+
include __DIR__ . '/loader.php';
|
92 |
+
|
93 |
+
$client = new SendGrid\Client();
|
94 |
+
```
|
95 |
+
|
96 |
+
<a name="quick-start"></a>
|
97 |
+
# Quick Start
|
98 |
+
|
99 |
+
Here is a quick example:
|
100 |
+
|
101 |
+
`GET /your/api/{param}/call`
|
102 |
+
|
103 |
+
```php
|
104 |
+
// include __DIR__ . '/loader.php';
|
105 |
+
require 'vendor/autoload.php';
|
106 |
+
$apiKey = YOUR_SENDGRID_API_KEY;
|
107 |
+
$authHeaders = [
|
108 |
+
'Authorization: Bearer ' . $apiKey
|
109 |
+
];
|
110 |
+
$client = new SendGrid\Client('https://api.sendgrid.com', $authHeaders);
|
111 |
+
$param = 'foo';
|
112 |
+
$response = $client->your()->api()->_($param)->call()->get();
|
113 |
+
|
114 |
+
var_dump(
|
115 |
+
$response->statusCode(),
|
116 |
+
$response->headers(),
|
117 |
+
$response->body()
|
118 |
+
);
|
119 |
+
```
|
120 |
+
|
121 |
+
`POST /your/api/{param}/call` with headers, query parameters and a request body with versioning.
|
122 |
+
|
123 |
+
```php
|
124 |
+
// include __DIR__ . '/loader.php';
|
125 |
+
require 'vendor/autoload.php';
|
126 |
+
$apiKey = YOUR_SENDGRID_API_KEY;
|
127 |
+
$authHeaders = [
|
128 |
+
'Authorization: Bearer ' . $apiKey
|
129 |
+
];
|
130 |
+
$client = new SendGrid\Client('https://api.sendgrid.com', $authHeaders);
|
131 |
+
$queryParams = [
|
132 |
+
'hello' => 0, 'world' => 1
|
133 |
+
];
|
134 |
+
$requestHeaders = [
|
135 |
+
'X-Test' => 'test'
|
136 |
+
];
|
137 |
+
$data = [
|
138 |
+
'some' => 1, 'awesome' => 2, 'data' => 3
|
139 |
+
];
|
140 |
+
$param = 'bar';
|
141 |
+
$response = $client->your()->api()->_($param)->call()->post($data, $queryParams, $requestHeaders);
|
142 |
+
|
143 |
+
var_dump(
|
144 |
+
$response->statusCode(),
|
145 |
+
$response->headers(),
|
146 |
+
$response->body()
|
147 |
+
);
|
148 |
+
```
|
149 |
+
|
150 |
+
<a name="usage"></a>
|
151 |
+
# Usage
|
152 |
+
|
153 |
+
- [Usage Examples](USAGE.md)
|
154 |
+
|
155 |
+
## Environment Variables
|
156 |
+
|
157 |
+
You can do the following to create a .env file:
|
158 |
+
|
159 |
+
```cp .env_example .env```
|
160 |
+
|
161 |
+
Then, just add your API Key into your .env file.
|
162 |
+
|
163 |
+
<a name="roadmap"></a>
|
164 |
+
# Roadmap
|
165 |
+
|
166 |
+
If you are interested in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback.
|
167 |
+
|
168 |
+
<a name="contribute"></a>
|
169 |
+
# How to Contribute
|
170 |
+
|
171 |
+
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md) guide for details.
|
172 |
+
|
173 |
+
Quick links:
|
174 |
+
|
175 |
+
- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature-request)
|
176 |
+
- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit-a-bug-report)
|
177 |
+
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#cla)
|
178 |
+
- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase)
|
179 |
+
- [Review Pull Requests](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#code-reviews)
|
180 |
+
|
181 |
+
<a name="thanks"></a>
|
182 |
+
# Thanks
|
183 |
+
|
184 |
+
We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient).
|
185 |
+
|
186 |
+
<a name="about"></a>
|
187 |
+
# About
|
188 |
+
|
189 |
+
php-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
|
190 |
+
|
191 |
+
php-http-client is maintained and funded by SendGrid, Inc. The names and logos for php-http-client are trademarks of SendGrid, Inc.
|
192 |
+
|
193 |
+
<a name="license"></a>
|
194 |
+
# License
|
195 |
+
[The MIT License (MIT)](LICENSE.txt)
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "sendgrid/php-http-client",
|
3 |
+
"description": "HTTP REST client, simplified for PHP",
|
4 |
+
"type": "library",
|
5 |
+
"version": "3.9.6",
|
6 |
+
"homepage": "http://github.com/sendgrid/php-http-client",
|
7 |
+
"keywords": ["SendGrid", "HTTP", "REST", "API", "Fluent"],
|
8 |
+
"license": "MIT",
|
9 |
+
"authors": [
|
10 |
+
{
|
11 |
+
"name": "Matt Bernier",
|
12 |
+
"email": "dx@sendgrid.com"
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"name": "Elmer Thomas",
|
16 |
+
"email": "elmer@thinkingserious.com"
|
17 |
+
}
|
18 |
+
],
|
19 |
+
"require": {
|
20 |
+
"php": ">=5.6"
|
21 |
+
},
|
22 |
+
"require-dev": {
|
23 |
+
"phpunit/phpunit": "~4.4",
|
24 |
+
"squizlabs/php_codesniffer": "~2.0"
|
25 |
+
},
|
26 |
+
"autoload": {
|
27 |
+
"psr-4": {
|
28 |
+
"SendGrid\\": "lib/"
|
29 |
+
}
|
30 |
+
},
|
31 |
+
"autoload-dev": {
|
32 |
+
"psr-4": {
|
33 |
+
"SendGrid\\Test\\": "test/unit/"
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php
ADDED
@@ -0,0 +1,596 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* HTTP Client library
|
5 |
+
*
|
6 |
+
* @author Matt Bernier <dx@sendgrid.com>
|
7 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
8 |
+
* @copyright 2018 SendGrid
|
9 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
10 |
+
* @version GIT: <git_id>
|
11 |
+
* @link http://packagist.org/packages/sendgrid/php-http-client
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace SendGrid;
|
15 |
+
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
* Class Client
|
19 |
+
* @package SendGrid
|
20 |
+
* @version 3.9.5
|
21 |
+
*
|
22 |
+
* Quickly and easily access any REST or REST-like API.
|
23 |
+
*
|
24 |
+
* @method Response get($body = null, $query = null, $headers = null)
|
25 |
+
* @method Response post($body = null, $query = null, $headers = null)
|
26 |
+
* @method Response patch($body = null, $query = null, $headers = null)
|
27 |
+
* @method Response put($body = null, $query = null, $headers = null)
|
28 |
+
* @method Response delete($body = null, $query = null, $headers = null)
|
29 |
+
*
|
30 |
+
* @method Client version($value)
|
31 |
+
* @method Client|Response send()
|
32 |
+
*
|
33 |
+
* Adding all the endpoints as a method so code completion works
|
34 |
+
*
|
35 |
+
* General
|
36 |
+
* @method Client stats()
|
37 |
+
* @method Client search()
|
38 |
+
* @method Client monthly()
|
39 |
+
* @method Client sums()
|
40 |
+
* @method Client monitor()
|
41 |
+
* @method Client test()
|
42 |
+
*
|
43 |
+
* Access settings
|
44 |
+
* @method Client access_settings()
|
45 |
+
* @method Client activity()
|
46 |
+
* @method Client whitelist()
|
47 |
+
*
|
48 |
+
* Alerts
|
49 |
+
* @method Client alerts()
|
50 |
+
*
|
51 |
+
* Api keys
|
52 |
+
* @method Client api_keys()
|
53 |
+
*
|
54 |
+
* ASM
|
55 |
+
* @method Client asm()
|
56 |
+
* @method Client groups()
|
57 |
+
*
|
58 |
+
* Browsers
|
59 |
+
* @method Client browsers()
|
60 |
+
*
|
61 |
+
* Campaigns
|
62 |
+
* @method Client campaigns()
|
63 |
+
* @method Client schedules()
|
64 |
+
* @method Client now()
|
65 |
+
*
|
66 |
+
* Categories
|
67 |
+
* @method Client categories()
|
68 |
+
*
|
69 |
+
* Clients
|
70 |
+
* @method Client clients()
|
71 |
+
*
|
72 |
+
* ContactDB
|
73 |
+
* @method Client contactdb()
|
74 |
+
* @method Client custom_fields()
|
75 |
+
* @method Client lists()
|
76 |
+
* @method Client recipients()
|
77 |
+
* @method Client billable_count()
|
78 |
+
* @method Client count()
|
79 |
+
* @method Client reserved_fields()
|
80 |
+
* @method Client segments()
|
81 |
+
*
|
82 |
+
* Devices
|
83 |
+
* @method Client devices()
|
84 |
+
*
|
85 |
+
* Geo
|
86 |
+
* @method Client geo()
|
87 |
+
*
|
88 |
+
* Ips
|
89 |
+
* @method Client ips()
|
90 |
+
* @method Client assigned()
|
91 |
+
* @method Client pools()
|
92 |
+
* @method Client warmup()
|
93 |
+
*
|
94 |
+
* Mail
|
95 |
+
* @method Client mail()
|
96 |
+
* @method Client batch()
|
97 |
+
*
|
98 |
+
* Mailbox Providers
|
99 |
+
* @method Client mailbox_providers()
|
100 |
+
*
|
101 |
+
* Mail settings
|
102 |
+
* @method Client mail_settings()
|
103 |
+
* @method Client address_whitelist()
|
104 |
+
* @method Client bcc()
|
105 |
+
* @method Client bounce_purge()
|
106 |
+
* @method Client footer()
|
107 |
+
* @method Client forward_bounce()
|
108 |
+
* @method Client forward_spam()
|
109 |
+
* @method Client plain_content()
|
110 |
+
* @method Client spam_check()
|
111 |
+
* @method Client template()
|
112 |
+
*
|
113 |
+
* Partner settings
|
114 |
+
* @method Client partner_settings()
|
115 |
+
* @method Client new_relic()
|
116 |
+
*
|
117 |
+
* Scopes
|
118 |
+
* @method Client scopes()
|
119 |
+
*
|
120 |
+
* Senders
|
121 |
+
* @method Client senders()
|
122 |
+
* @method Client resend_verification()
|
123 |
+
*
|
124 |
+
* Sub Users
|
125 |
+
* @method Client subusers()
|
126 |
+
* @method Client reputations()
|
127 |
+
*
|
128 |
+
* Supressions
|
129 |
+
* @method Client suppressions()
|
130 |
+
* @method Client global()
|
131 |
+
* @method Client blocks()
|
132 |
+
* @method Client bounces()
|
133 |
+
* @method Client invalid_emails()
|
134 |
+
* @method Client spam_reports()
|
135 |
+
* @method Client unsubcribes()
|
136 |
+
*
|
137 |
+
* Templates
|
138 |
+
* @method Client templates()
|
139 |
+
* @method Client versions()
|
140 |
+
* @method Client activate()
|
141 |
+
*
|
142 |
+
* Tracking settings
|
143 |
+
* @method Client tracking_settings()
|
144 |
+
* @method Client click()
|
145 |
+
* @method Client google_analytics()
|
146 |
+
* @method Client open()
|
147 |
+
* @method Client subscription()
|
148 |
+
*
|
149 |
+
* User
|
150 |
+
* @method Client user()
|
151 |
+
* @method Client account()
|
152 |
+
* @method Client credits()
|
153 |
+
* @method Client email()
|
154 |
+
* @method Client password()
|
155 |
+
* @method Client profile()
|
156 |
+
* @method Client scheduled_sends()
|
157 |
+
* @method Client enforced_tls()
|
158 |
+
* @method Client settings()
|
159 |
+
* @method Client username()
|
160 |
+
* @method Client webhooks()
|
161 |
+
* @method Client event()
|
162 |
+
* @method Client parse()
|
163 |
+
*
|
164 |
+
* Missed any? Simply add them by doing: @method Client method()
|
165 |
+
*/
|
166 |
+
class Client
|
167 |
+
{
|
168 |
+
const TOO_MANY_REQUESTS_HTTP_CODE = 429;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @var string
|
172 |
+
*/
|
173 |
+
protected $host;
|
174 |
+
|
175 |
+
/**
|
176 |
+
* @var array
|
177 |
+
*/
|
178 |
+
protected $headers;
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @var string
|
182 |
+
*/
|
183 |
+
protected $version;
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @var array
|
187 |
+
*/
|
188 |
+
protected $path;
|
189 |
+
|
190 |
+
/**
|
191 |
+
* @var array
|
192 |
+
*/
|
193 |
+
protected $curlOptions;
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @var bool
|
197 |
+
*/
|
198 |
+
protected $isConcurrentRequest;
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @var array
|
202 |
+
*/
|
203 |
+
protected $savedRequests;
|
204 |
+
|
205 |
+
/**
|
206 |
+
* @var bool
|
207 |
+
*/
|
208 |
+
protected $retryOnLimit;
|
209 |
+
|
210 |
+
/**
|
211 |
+
* These are the supported HTTP verbs
|
212 |
+
*
|
213 |
+
* @var array
|
214 |
+
*/
|
215 |
+
private $methods = ['get', 'post', 'patch', 'put', 'delete'];
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Initialize the client
|
219 |
+
*
|
220 |
+
* @param string $host the base url (e.g. https://api.sendgrid.com)
|
221 |
+
* @param array $headers global request headers
|
222 |
+
* @param string $version api version (configurable) - this is specific to the SendGrid API
|
223 |
+
* @param array $path holds the segments of the url path
|
224 |
+
* @param array $curlOptions extra options to set during curl initialization
|
225 |
+
* @param bool $retryOnLimit set default retry on limit flag
|
226 |
+
*/
|
227 |
+
public function __construct($host, $headers = null, $version = null, $path = null, $curlOptions = null, $retryOnLimit = false)
|
228 |
+
{
|
229 |
+
$this->host = $host;
|
230 |
+
$this->headers = $headers ?: [];
|
231 |
+
$this->version = $version;
|
232 |
+
$this->path = $path ?: [];
|
233 |
+
$this->curlOptions = $curlOptions ?: [];
|
234 |
+
$this->retryOnLimit = $retryOnLimit;
|
235 |
+
$this->isConcurrentRequest = false;
|
236 |
+
$this->savedRequests = [];
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* @return string
|
241 |
+
*/
|
242 |
+
public function getHost()
|
243 |
+
{
|
244 |
+
return $this->host;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* @return array
|
249 |
+
*/
|
250 |
+
public function getHeaders()
|
251 |
+
{
|
252 |
+
return $this->headers;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* @return string|null
|
257 |
+
*/
|
258 |
+
public function getVersion()
|
259 |
+
{
|
260 |
+
return $this->version;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @return array
|
265 |
+
*/
|
266 |
+
public function getPath()
|
267 |
+
{
|
268 |
+
return $this->path;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* @return array
|
273 |
+
*/
|
274 |
+
public function getCurlOptions()
|
275 |
+
{
|
276 |
+
return $this->curlOptions;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Set extra options to set during curl initialization
|
281 |
+
*
|
282 |
+
* @param array $options
|
283 |
+
*
|
284 |
+
* @return Client
|
285 |
+
*/
|
286 |
+
public function setCurlOptions(array $options)
|
287 |
+
{
|
288 |
+
$this->curlOptions = $options;
|
289 |
+
|
290 |
+
return $this;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Set default retry on limit flag
|
295 |
+
*
|
296 |
+
* @param bool $retry
|
297 |
+
*
|
298 |
+
* @return Client
|
299 |
+
*/
|
300 |
+
public function setRetryOnLimit($retry)
|
301 |
+
{
|
302 |
+
$this->retryOnLimit = $retry;
|
303 |
+
|
304 |
+
return $this;
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Set concurrent request flag
|
309 |
+
*
|
310 |
+
* @param bool $isConcurrent
|
311 |
+
*
|
312 |
+
* @return Client
|
313 |
+
*/
|
314 |
+
public function setIsConcurrentRequest($isConcurrent)
|
315 |
+
{
|
316 |
+
$this->isConcurrentRequest = $isConcurrent;
|
317 |
+
|
318 |
+
return $this;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Build the final URL to be passed
|
323 |
+
*
|
324 |
+
* @param array $queryParams an array of all the query parameters
|
325 |
+
*
|
326 |
+
* @return string
|
327 |
+
*/
|
328 |
+
private function buildUrl($queryParams = null)
|
329 |
+
{
|
330 |
+
$path = '/' . implode('/', $this->path);
|
331 |
+
if (isset($queryParams)) {
|
332 |
+
$path .= '?' . http_build_query($queryParams);
|
333 |
+
}
|
334 |
+
return sprintf('%s%s%s', $this->host, $this->version ?: '', $path);
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Creates curl options for a request
|
339 |
+
* this function does not mutate any private variables
|
340 |
+
*
|
341 |
+
* @param string $method
|
342 |
+
* @param array $body
|
343 |
+
* @param array $headers
|
344 |
+
*
|
345 |
+
* @return array
|
346 |
+
*/
|
347 |
+
private function createCurlOptions($method, $body = null, $headers = null)
|
348 |
+
{
|
349 |
+
$options = [
|
350 |
+
CURLOPT_RETURNTRANSFER => true,
|
351 |
+
CURLOPT_HEADER => true,
|
352 |
+
CURLOPT_CUSTOMREQUEST => strtoupper($method),
|
353 |
+
CURLOPT_SSL_VERIFYPEER => true,
|
354 |
+
CURLOPT_FAILONERROR => false
|
355 |
+
] + $this->curlOptions;
|
356 |
+
|
357 |
+
if (isset($headers)) {
|
358 |
+
$headers = array_merge($this->headers, $headers);
|
359 |
+
} else {
|
360 |
+
$headers = $this->headers;
|
361 |
+
}
|
362 |
+
|
363 |
+
if (isset($body)) {
|
364 |
+
$encodedBody = json_encode($body);
|
365 |
+
$options[CURLOPT_POSTFIELDS] = $encodedBody;
|
366 |
+
$headers = array_merge($headers, ['Content-Type: application/json']);
|
367 |
+
}
|
368 |
+
$options[CURLOPT_HTTPHEADER] = $headers;
|
369 |
+
|
370 |
+
return $options;
|
371 |
+
}
|
372 |
+
|
373 |
+
/**
|
374 |
+
* @param array $requestData
|
375 |
+
* e.g. ['method' => 'POST', 'url' => 'www.example.com', 'body' => 'test body', 'headers' => []]
|
376 |
+
* @param bool $retryOnLimit
|
377 |
+
*
|
378 |
+
* @return array
|
379 |
+
*/
|
380 |
+
private function createSavedRequest(array $requestData, $retryOnLimit = false)
|
381 |
+
{
|
382 |
+
return array_merge($requestData, ['retryOnLimit' => $retryOnLimit]);
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* @param array $requests
|
387 |
+
*
|
388 |
+
* @return array
|
389 |
+
*/
|
390 |
+
private function createCurlMultiHandle(array $requests)
|
391 |
+
{
|
392 |
+
$channels = [];
|
393 |
+
$multiHandle = curl_multi_init();
|
394 |
+
|
395 |
+
foreach ($requests as $id => $data) {
|
396 |
+
$channels[$id] = curl_init($data['url']);
|
397 |
+
$curlOpts = $this->createCurlOptions($data['method'], $data['body'], $data['headers']);
|
398 |
+
curl_setopt_array($channels[$id], $curlOpts);
|
399 |
+
curl_multi_add_handle($multiHandle, $channels[$id]);
|
400 |
+
}
|
401 |
+
|
402 |
+
return [$channels, $multiHandle];
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Prepare response object
|
407 |
+
*
|
408 |
+
* @param resource $channel the curl resource
|
409 |
+
* @param string $content
|
410 |
+
*
|
411 |
+
* @return Response object
|
412 |
+
*/
|
413 |
+
private function parseResponse($channel, $content)
|
414 |
+
{
|
415 |
+
$headerSize = curl_getinfo($channel, CURLINFO_HEADER_SIZE);
|
416 |
+
$statusCode = curl_getinfo($channel, CURLINFO_HTTP_CODE);
|
417 |
+
|
418 |
+
$responseBody = substr($content, $headerSize);
|
419 |
+
|
420 |
+
$responseHeaders = substr($content, 0, $headerSize);
|
421 |
+
$responseHeaders = explode("\n", $responseHeaders);
|
422 |
+
$responseHeaders = array_map('trim', $responseHeaders);
|
423 |
+
|
424 |
+
return new Response($statusCode, $responseBody, $responseHeaders);
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Retry request
|
429 |
+
*
|
430 |
+
* @param array $responseHeaders headers from rate limited response
|
431 |
+
* @param string $method the HTTP verb
|
432 |
+
* @param string $url the final url to call
|
433 |
+
* @param array $body request body
|
434 |
+
* @param array $headers original headers
|
435 |
+
*
|
436 |
+
* @return Response response object
|
437 |
+
*/
|
438 |
+
private function retryRequest(array $responseHeaders, $method, $url, $body, $headers)
|
439 |
+
{
|
440 |
+
$sleepDurations = $responseHeaders['X-Ratelimit-Reset'] - time();
|
441 |
+
sleep($sleepDurations > 0 ? $sleepDurations : 0);
|
442 |
+
return $this->makeRequest($method, $url, $body, $headers, false);
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Make the API call and return the response.
|
447 |
+
* This is separated into it's own function, so we can mock it easily for testing.
|
448 |
+
*
|
449 |
+
* @param string $method the HTTP verb
|
450 |
+
* @param string $url the final url to call
|
451 |
+
* @param array $body request body
|
452 |
+
* @param array $headers any additional request headers
|
453 |
+
* @param bool $retryOnLimit should retry if rate limit is reach?
|
454 |
+
*
|
455 |
+
* @return Response object
|
456 |
+
*/
|
457 |
+
public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false)
|
458 |
+
{
|
459 |
+
$channel = curl_init($url);
|
460 |
+
|
461 |
+
$options = $this->createCurlOptions($method, $body, $headers);
|
462 |
+
|
463 |
+
curl_setopt_array($channel, $options);
|
464 |
+
$content = curl_exec($channel);
|
465 |
+
|
466 |
+
$response = $this->parseResponse($channel, $content);
|
467 |
+
|
468 |
+
if ($response->statusCode() === self::TOO_MANY_REQUESTS_HTTP_CODE && $retryOnLimit) {
|
469 |
+
$responseHeaders = $response->headers(true);
|
470 |
+
return $this->retryRequest($responseHeaders, $method, $url, $body, $headers);
|
471 |
+
}
|
472 |
+
|
473 |
+
curl_close($channel);
|
474 |
+
|
475 |
+
return $response;
|
476 |
+
}
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Send all saved requests at once
|
480 |
+
*
|
481 |
+
* @param array $requests
|
482 |
+
*
|
483 |
+
* @return Response[]
|
484 |
+
*/
|
485 |
+
public function makeAllRequests(array $requests = [])
|
486 |
+
{
|
487 |
+
if (empty($requests)) {
|
488 |
+
$requests = $this->savedRequests;
|
489 |
+
}
|
490 |
+
list($channels, $multiHandle) = $this->createCurlMultiHandle($requests);
|
491 |
+
|
492 |
+
// running all requests
|
493 |
+
$isRunning = null;
|
494 |
+
do {
|
495 |
+
curl_multi_exec($multiHandle, $isRunning);
|
496 |
+
} while ($isRunning);
|
497 |
+
|
498 |
+
// get response and close all handles
|
499 |
+
$retryRequests = [];
|
500 |
+
$responses = [];
|
501 |
+
$sleepDurations = 0;
|
502 |
+
foreach ($channels as $id => $channel) {
|
503 |
+
|
504 |
+
$content = curl_multi_getcontent($channel);
|
505 |
+
$response = $this->parseResponse($channel, $content);
|
506 |
+
|
507 |
+
if ($response->statusCode() === self::TOO_MANY_REQUESTS_HTTP_CODE && $requests[$id]['retryOnLimit']) {
|
508 |
+
$headers = $response->headers(true);
|
509 |
+
$sleepDurations = max($sleepDurations, $headers['X-Ratelimit-Reset'] - time());
|
510 |
+
$requestData = [
|
511 |
+
'method' => $requests[$id]['method'],
|
512 |
+
'url' => $requests[$id]['url'],
|
513 |
+
'body' => $requests[$id]['body'],
|
514 |
+
'headers' => $headers,
|
515 |
+
];
|
516 |
+
$retryRequests[] = $this->createSavedRequest($requestData, false);
|
517 |
+
} else {
|
518 |
+
$responses[] = $response;
|
519 |
+
}
|
520 |
+
|
521 |
+
curl_multi_remove_handle($multiHandle, $channel);
|
522 |
+
}
|
523 |
+
curl_multi_close($multiHandle);
|
524 |
+
|
525 |
+
// retry requests
|
526 |
+
if (!empty($retryRequests)) {
|
527 |
+
sleep($sleepDurations > 0 ? $sleepDurations : 0);
|
528 |
+
$responses = array_merge($responses, $this->makeAllRequests($retryRequests));
|
529 |
+
}
|
530 |
+
return $responses;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* Add variable values to the url. (e.g. /your/api/{variable_value}/call)
|
535 |
+
* Another example: if you have a PHP reserved word, such as and, in your url, you must use this method.
|
536 |
+
*
|
537 |
+
* @param string $name name of the url segment
|
538 |
+
*
|
539 |
+
* @return Client object
|
540 |
+
*/
|
541 |
+
public function _($name = null)
|
542 |
+
{
|
543 |
+
if (isset($name)) {
|
544 |
+
$this->path[] = $name;
|
545 |
+
}
|
546 |
+
$client = new static($this->host, $this->headers, $this->version, $this->path);
|
547 |
+
$client->setCurlOptions($this->curlOptions);
|
548 |
+
$client->setRetryOnLimit($this->retryOnLimit);
|
549 |
+
$this->path = [];
|
550 |
+
|
551 |
+
return $client;
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Dynamically add method calls to the url, then call a method.
|
556 |
+
* (e.g. client.name.name.method())
|
557 |
+
*
|
558 |
+
* @param string $name name of the dynamic method call or HTTP verb
|
559 |
+
* @param array $args parameters passed with the method call
|
560 |
+
*
|
561 |
+
* @return Client|Response|Response[]|null object
|
562 |
+
*/
|
563 |
+
public function __call($name, $args)
|
564 |
+
{
|
565 |
+
$name = strtolower($name);
|
566 |
+
|
567 |
+
if ($name === 'version') {
|
568 |
+
$this->version = $args[0];
|
569 |
+
return $this->_();
|
570 |
+
}
|
571 |
+
|
572 |
+
// send all saved requests
|
573 |
+
if (($name === 'send') && $this->isConcurrentRequest) {
|
574 |
+
return $this->makeAllRequests();
|
575 |
+
}
|
576 |
+
|
577 |
+
if (in_array($name, $this->methods, true)) {
|
578 |
+
$body = isset($args[0]) ? $args[0] : null;
|
579 |
+
$queryParams = isset($args[1]) ? $args[1] : null;
|
580 |
+
$url = $this->buildUrl($queryParams);
|
581 |
+
$headers = isset($args[2]) ? $args[2] : null;
|
582 |
+
$retryOnLimit = isset($args[3]) ? $args[3] : $this->retryOnLimit;
|
583 |
+
|
584 |
+
if ($this->isConcurrentRequest) {
|
585 |
+
// save request to be sent later
|
586 |
+
$requestData = ['method' => $name, 'url' => $url, 'body' => $body, 'headers' => $headers];
|
587 |
+
$this->savedRequests[] = $this->createSavedRequest($requestData, $retryOnLimit);
|
588 |
+
return null;
|
589 |
+
}
|
590 |
+
|
591 |
+
return $this->makeRequest($name, $url, $body, $headers, $retryOnLimit);
|
592 |
+
}
|
593 |
+
|
594 |
+
return $this->_($name);
|
595 |
+
}
|
596 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* HTTP Client library
|
5 |
+
*
|
6 |
+
* @author Matt Bernier <dx@sendgrid.com>
|
7 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
8 |
+
* @copyright 2018 SendGrid
|
9 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
10 |
+
* @version GIT: <git_id>
|
11 |
+
* @link http://packagist.org/packages/sendgrid/php-http-client
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace SendGrid;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Holds the response from an API call.
|
18 |
+
*/
|
19 |
+
class Response
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* @var int
|
23 |
+
*/
|
24 |
+
protected $statusCode;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
protected $body;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var array
|
33 |
+
*/
|
34 |
+
protected $headers;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Setup the response data
|
38 |
+
*
|
39 |
+
* @param int $statusCode the status code.
|
40 |
+
* @param string $body the response body.
|
41 |
+
* @param array $headers an array of response headers.
|
42 |
+
*/
|
43 |
+
public function __construct($statusCode = 200, $body = '', array $headers = [])
|
44 |
+
{
|
45 |
+
$this->statusCode = $statusCode;
|
46 |
+
$this->body = $body;
|
47 |
+
$this->headers = $headers;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* The status code
|
52 |
+
*
|
53 |
+
* @return int
|
54 |
+
*/
|
55 |
+
public function statusCode()
|
56 |
+
{
|
57 |
+
return $this->statusCode;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The response body
|
62 |
+
*
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function body()
|
66 |
+
{
|
67 |
+
return $this->body;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* The response headers
|
72 |
+
*
|
73 |
+
* @param bool $assoc
|
74 |
+
*
|
75 |
+
* @return array
|
76 |
+
*/
|
77 |
+
public function headers($assoc = false)
|
78 |
+
{
|
79 |
+
if (!$assoc) {
|
80 |
+
return $this->headers;
|
81 |
+
}
|
82 |
+
|
83 |
+
return $this->prettifyHeaders($this->headers);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Returns response headers as associative array
|
88 |
+
*
|
89 |
+
* @param array $headers
|
90 |
+
*
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
private function prettifyHeaders(array $headers)
|
94 |
+
{
|
95 |
+
return array_reduce(
|
96 |
+
array_filter($headers),
|
97 |
+
function ($result, $header) {
|
98 |
+
|
99 |
+
if (false === strpos($header, ':')) {
|
100 |
+
$result['Status'] = trim($header);
|
101 |
+
|
102 |
+
return $result;
|
103 |
+
}
|
104 |
+
|
105 |
+
list($key, $value) = explode(':', $header, 2);
|
106 |
+
$result[trim($key)] = trim($value);
|
107 |
+
|
108 |
+
return $result;
|
109 |
+
},
|
110 |
+
[]
|
111 |
+
);
|
112 |
+
}
|
113 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.codeclimate.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
engines:
|
3 |
+
duplication:
|
4 |
+
enabled: true
|
5 |
+
config:
|
6 |
+
languages:
|
7 |
+
- php
|
8 |
+
fixme:
|
9 |
+
enabled: true
|
10 |
+
phpmd:
|
11 |
+
enabled: true
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.editorconfig
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
root = true
|
2 |
+
|
3 |
+
[*.php]
|
4 |
+
indent_style = space
|
5 |
+
indent_size = 4
|
6 |
+
end_of_line = lf
|
7 |
+
insert_final_newline = true
|
8 |
+
trim_trailing_whitespace = true
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.env.sample
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
export SENDGRID_API_KEY=''
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#### Issue Summary
|
2 |
+
|
3 |
+
A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
|
4 |
+
|
5 |
+
#### Steps to Reproduce
|
6 |
+
|
7 |
+
1. This is the first step
|
8 |
+
2. This is the second step
|
9 |
+
3. Further steps, etc.
|
10 |
+
|
11 |
+
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
|
12 |
+
|
13 |
+
#### Technical details:
|
14 |
+
|
15 |
+
* sendgrid-php Version: master (latest commit: [commit number])
|
16 |
+
* PHP Version: 5.6, 7.0, 7.1, 7.2 (as of May 17, 2018)
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/PULL_REQUEST_TEMPLATE
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.
|
3 |
+
|
4 |
+
**All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.**
|
5 |
+
|
6 |
+
Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
|
7 |
+
e.g.
|
8 |
+
Fixes #1
|
9 |
+
Closes #2
|
10 |
+
-->
|
11 |
+
# Fixes #
|
12 |
+
|
13 |
+
### Checklist
|
14 |
+
- [ ] I acknowledge that all my contributions will be made under the project's license
|
15 |
+
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
|
16 |
+
- [ ] I have read the [Contribution Guide] and my PR follows them.
|
17 |
+
- [ ] I updated my branch with the development branch.
|
18 |
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
19 |
+
- [ ] I have added necessary documentation about the functionality in the appropriate .md file
|
20 |
+
- [ ] I have added in line documentation to the code I modified
|
21 |
+
|
22 |
+
### Short description of what this PR does:
|
23 |
+
-
|
24 |
+
-
|
25 |
+
|
26 |
+
If you have questions, please send an email to [Twilio Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
before_script:
|
4 |
+
- composer install
|
5 |
+
- "./test/prism.sh &"
|
6 |
+
- sleep 60
|
7 |
+
- cd test
|
8 |
+
|
9 |
+
script:
|
10 |
+
- "../vendor/bin/phpunit . --filter test*"
|
11 |
+
|
12 |
+
after_script:
|
13 |
+
- cd ../
|
14 |
+
after_success:
|
15 |
+
- bash <(curl -s https://codecov.io/bash)
|
16 |
+
|
17 |
+
php:
|
18 |
+
- 5.6
|
19 |
+
- 7.0
|
20 |
+
- 7.1
|
21 |
+
- 7.2
|
22 |
+
- 7.3
|
23 |
+
|
24 |
+
notifications:
|
25 |
+
hipchat:
|
26 |
+
rooms:
|
27 |
+
secure: l4RUOBY44kVhSxx54NU3cmvn598rRMB7Y272Ct/W0fBm1tdGncp42A/rwg7JkiZH9EWXs3tKtoSjqw5xT6QeScUGQDdykS5QVO8lEIkDRGD4WwQ3VDJmRy1+04WtgqFEK8SyYTCcCl4ZJ0rtOcJZgDMvigkOJuLxwGXTDuvfu1k=
|
28 |
+
template:
|
29 |
+
- '<a href="https://travis-ci.org/%{repository}/builds/%{build_id}">%{repository}
|
30 |
+
Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong>
|
31 |
+
<a href="https://github.com/%{repository}/commits/%{commit}">View on GitHub</a>'
|
32 |
+
format: html
|
33 |
+
notify: true
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Twilio SendGrid Community Code of Conduct
|
2 |
+
|
3 |
+
The Twilio SendGrid open source community is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences successes and continued growth. When you're working with members of the community, we encourage you to follow these guidelines, which help steer our interactions and strive to maintain a positive, successful and growing community.
|
4 |
+
|
5 |
+
### Be Open
|
6 |
+
Members of the community are open to collaboration, whether it's on pull requests, code reviews, approvals, issues or otherwise. We're receptive to constructive comments and criticism, as the experiences and skill sets of all members contribute to the whole of our efforts. We're accepting of all who wish to take part in our activities, fostering an environment where anyone can participate, and everyone can make a difference.
|
7 |
+
|
8 |
+
### Be Considerate
|
9 |
+
Members of the community are considerate of their peers, which include other contributors and users of Twilio SendGrid. We're thoughtful when addressing the efforts of others, keeping in mind that often the labor was completed with the intent of the good of the community. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.
|
10 |
+
|
11 |
+
### Be Respectful
|
12 |
+
Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments and their efforts. We're respectful of the volunteer efforts that permeate the Twilio SendGrid community. We're respectful of the processes outlined in the community, and we work within them. When we disagree, we are courteous in raising our issues. Overall, we're good to each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.
|
13 |
+
|
14 |
+
## Additional Guidance
|
15 |
+
|
16 |
+
### Disclose Potential Conflicts of Interest
|
17 |
+
Community discussions often involve interested parties. We expect participants to be aware when they are conflicted due to employment or other projects they are involved in and disclose those interests to other project members. When in doubt, over-disclose. Perceived conflicts of interest are important to address so that the community’s decisions are credible even when unpopular, difficult or favorable to the interests of one group over another.
|
18 |
+
|
19 |
+
### Interpretation
|
20 |
+
This Code is not exhaustive or complete. It is not a rulebook; it serves to distill our common understanding of a collaborative, shared environment and goals. We expect it to be followed in spirit as much as in the letter. When in doubt, try to abide by [Twilio SendGrid’s cultural values](https://sendgrid.com/blog/employee-engagement-the-4h-way) defined by our “4H’s”: Happy, Hungry, Humble and Honest.
|
21 |
+
|
22 |
+
### Enforcement
|
23 |
+
Most members of the Twilio SendGrid community always comply with this Code, not because of the existence of this Code, but because they have long experience participating in open source communities where the conduct described above is normal and expected. However, failure to observe this Code may be grounds for suspension, reporting the user for abuse or changing permissions for outside contributors.
|
24 |
+
|
25 |
+
## If you have concerns about someone’s conduct
|
26 |
+
**Initiate Direct Contact** - It is always appropriate to email a community member (if contact information is available), mention that you think their behavior was out of line, and (if necessary) point them to this Code.
|
27 |
+
|
28 |
+
**Discuss Publicly** - Discussing publicly is always acceptable. Note, though, that approaching the person directly may be better, as it tends to make them less defensive, and it respects the time of other community members, so you probably want to try direct contact first.
|
29 |
+
|
30 |
+
**Contact the Moderators** - You can reach the Twilio SendGrid moderators by emailing dx@sendgrid.com.
|
31 |
+
|
32 |
+
## Attribution
|
33 |
+
|
34 |
+
Twilio SendGrid thanks the following, on which it draws for content and inspiration:
|
35 |
+
|
36 |
+
* [Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/)
|
37 |
+
* [Open Source Initiative General Code of Conduct](https://opensource.org/codeofconduct)
|
38 |
+
* [Apache Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2012-19 Twilio SendGrid, Inc.
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
![SendGrid Logo](https://github.com/sendgrid/sendgrid-python/raw/master/twilio_sendgrid_logo.png)
|
2 |
+
|
3 |
+
[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-php.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-php)
|
4 |
+
[![Packagist](https://img.shields.io/packagist/v/sendgrid/sendgrid.svg)](https://packagist.org/packages/sendgrid/sendgrid)
|
5 |
+
[![Downloads](https://img.shields.io/packagist/dt/sendgrid/sendgrid.svg?maxAge=3600)](https://packagist.org/packages/sendgrid/sendgrid)
|
6 |
+
[![Email Notifications Badge](https://dx.sendgrid.com/badge/php)](https://dx.sendgrid.com/newsletter/php)
|
7 |
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)
|
8 |
+
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
|
9 |
+
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-php.svg)](https://github.com/sendgrid/sendgrid-php/graphs/contributors)
|
10 |
+
[![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-php/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-php)
|
11 |
+
|
12 |
+
**NEW:**
|
13 |
+
- Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes.
|
14 |
+
- Send SMS messages with [Twilio](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#sms).
|
15 |
+
|
16 |
+
**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP.**
|
17 |
+
|
18 |
+
Version 7.X.X of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).
|
19 |
+
|
20 |
+
We want this library to be community driven and Twilio SendGrid led. Your help is needed to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.
|
21 |
+
|
22 |
+
Please browse the rest of this README for further details.
|
23 |
+
|
24 |
+
We appreciate your continued support, thank you!
|
25 |
+
|
26 |
+
# Table of Contents
|
27 |
+
|
28 |
+
* [Installation](#installation)
|
29 |
+
* [Quick Start](#quick-start)
|
30 |
+
* [Use Cases](#use-cases)
|
31 |
+
* [Usage](#usage)
|
32 |
+
* [Announcements](#announcements)
|
33 |
+
* [Roadmap](#roadmap)
|
34 |
+
* [How to Contribute](#contribute)
|
35 |
+
* [Troubleshooting](#troubleshooting)
|
36 |
+
* [About](#about)
|
37 |
+
* [License](#license)
|
38 |
+
|
39 |
+
<a name="installation"></a>
|
40 |
+
# Installation
|
41 |
+
|
42 |
+
## Prerequisites
|
43 |
+
|
44 |
+
- PHP version 5.6, 7.0, 7.1 or 7.2
|
45 |
+
- The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-php).
|
46 |
+
- For SMS messages, you will need a free [Twilio account](https://www.twilio.com/try-twilio?source=sendgrid-php).
|
47 |
+
|
48 |
+
## Setup Environment Variables
|
49 |
+
|
50 |
+
Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:
|
51 |
+
|
52 |
+
1. Copy the sample env file to a new file named `.env`
|
53 |
+
```bash
|
54 |
+
cp .env.sample .env
|
55 |
+
```
|
56 |
+
2. Edit the `.env` file to include your `SENDGRID_API_KEY`
|
57 |
+
3. Source the `.env` file
|
58 |
+
```bash
|
59 |
+
source ./.env
|
60 |
+
```
|
61 |
+
|
62 |
+
## Install Package
|
63 |
+
|
64 |
+
Add Twilio SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), we highly recommend it. It's an excellent way to manage dependencies in your PHP application.
|
65 |
+
|
66 |
+
```json
|
67 |
+
{
|
68 |
+
"require": {
|
69 |
+
"sendgrid/sendgrid": "~7"
|
70 |
+
}
|
71 |
+
}
|
72 |
+
```
|
73 |
+
|
74 |
+
#### Alternative: Install package from zip
|
75 |
+
|
76 |
+
If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/releases/download/v7.3.0/sendgrid-php.zip)**.
|
77 |
+
|
78 |
+
[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/releases/download/v7.3.0/sendgrid-php.zip)
|
79 |
+
|
80 |
+
Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from [GitHub](https://github.com/sendgrid/sendgrid-php/releases).
|
81 |
+
|
82 |
+
## Dependencies
|
83 |
+
|
84 |
+
- The Twilio SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php)
|
85 |
+
- The dependency free [php-http-client](https://github.com/sendgrid/php-http-client)
|
86 |
+
|
87 |
+
<a name="quick-start"></a>
|
88 |
+
# Quick Start
|
89 |
+
|
90 |
+
## Hello Email
|
91 |
+
|
92 |
+
The following is the minimum needed code to send an email. You may find more examples in our USE_CASES file:
|
93 |
+
|
94 |
+
```php
|
95 |
+
<?php
|
96 |
+
require 'vendor/autoload.php'; // If you're using Composer (recommended)
|
97 |
+
// Comment out the above line if not using Composer
|
98 |
+
// require("<PATH TO>/sendgrid-php.php");
|
99 |
+
// If not using Composer, uncomment the above line and
|
100 |
+
// download sendgrid-php.zip from the latest release here,
|
101 |
+
// replacing <PATH TO> with the path to the sendgrid-php.php file,
|
102 |
+
// which is included in the download:
|
103 |
+
// https://github.com/sendgrid/sendgrid-php/releases
|
104 |
+
|
105 |
+
$email = new \SendGrid\Mail\Mail();
|
106 |
+
$email->setFrom("test@example.com", "Example User");
|
107 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun");
|
108 |
+
$email->addTo("test@example.com", "Example User");
|
109 |
+
$email->addContent("text/plain", "and easy to do anywhere, even with PHP");
|
110 |
+
$email->addContent(
|
111 |
+
"text/html", "<strong>and easy to do anywhere, even with PHP</strong>"
|
112 |
+
);
|
113 |
+
$sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY'));
|
114 |
+
try {
|
115 |
+
$response = $sendgrid->send($email);
|
116 |
+
print $response->statusCode() . "\n";
|
117 |
+
print_r($response->headers());
|
118 |
+
print $response->body() . "\n";
|
119 |
+
} catch (Exception $e) {
|
120 |
+
echo 'Caught exception: '. $e->getMessage() ."\n";
|
121 |
+
}
|
122 |
+
```
|
123 |
+
|
124 |
+
The `SendGrid\Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#kitchen-sink) is an example of how to add to it.
|
125 |
+
|
126 |
+
## General v3 Web API Usage (With Fluent Interface)
|
127 |
+
|
128 |
+
```php
|
129 |
+
<?php
|
130 |
+
require 'vendor/autoload.php'; // If you're using Composer (recommended)
|
131 |
+
// Comment out the above line if not using Composer
|
132 |
+
// Comment out the above line if not using Composer
|
133 |
+
// require("<PATH TO>/sendgrid-php.php");
|
134 |
+
// If not using Composer, uncomment the above line and
|
135 |
+
// download sendgrid-php.zip from the latest release here,
|
136 |
+
// replacing <PATH TO> with the path to the sendgrid-php.php file,
|
137 |
+
// which is included in the download:
|
138 |
+
// https://github.com/sendgrid/sendgrid-php/releases
|
139 |
+
|
140 |
+
$apiKey = getenv('SENDGRID_API_KEY');
|
141 |
+
$sg = new \SendGrid($apiKey);
|
142 |
+
|
143 |
+
try {
|
144 |
+
$response = $sg->client->suppression()->bounces()->get();
|
145 |
+
print $response->statusCode() . "\n";
|
146 |
+
print_r($response->headers());
|
147 |
+
print $response->body() . "\n";
|
148 |
+
} catch (Exception $e) {
|
149 |
+
echo 'Caught exception: '. $e->getMessage(). "\n";
|
150 |
+
}
|
151 |
+
```
|
152 |
+
|
153 |
+
## General v3 Web API Usage (Without Fluent Interface)
|
154 |
+
|
155 |
+
```php
|
156 |
+
<?php
|
157 |
+
require 'vendor/autoload.php'; // If you're using Composer (recommended)
|
158 |
+
// Comment out the above line if not using Composer
|
159 |
+
// Comment out the above line if not using Composer
|
160 |
+
// require("<PATH TO>/sendgrid-php.php");
|
161 |
+
// If not using Composer, uncomment the above line and
|
162 |
+
// download sendgrid-php.zip from the latest release here,
|
163 |
+
// replacing <PATH TO> with the path to the sendgrid-php.php file,
|
164 |
+
// which is included in the download:
|
165 |
+
// https://github.com/sendgrid/sendgrid-php/releases
|
166 |
+
|
167 |
+
$apiKey = getenv('SENDGRID_API_KEY');
|
168 |
+
$sg = new \SendGrid($apiKey);
|
169 |
+
|
170 |
+
try {
|
171 |
+
$response = $sg->client->_("suppression/bounces")->get();
|
172 |
+
print $response->statusCode() . "\n";
|
173 |
+
print_r($response->headers());
|
174 |
+
print $response->body() . "\n";
|
175 |
+
} catch (Exception $e) {
|
176 |
+
echo 'Caught exception: '. $e->getMessage(). "\n";
|
177 |
+
}
|
178 |
+
```
|
179 |
+
|
180 |
+
<a name="use-cases"></a>
|
181 |
+
# Use Cases
|
182 |
+
|
183 |
+
[Examples of common API use cases](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), such as how to send an email with a transactional template.
|
184 |
+
|
185 |
+
<a name="usage"></a>
|
186 |
+
# Usage
|
187 |
+
|
188 |
+
- [Twilio SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
|
189 |
+
- [Generic Library Usage
|
190 |
+
Documentation](https://github.com/sendgrid/sendgrid-php/tree/master/USAGE.md)
|
191 |
+
- [Example Code](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md)
|
192 |
+
|
193 |
+
<a name="announcements"></a>
|
194 |
+
# Announcements
|
195 |
+
|
196 |
+
v7 has been released! Please see the [release notes](https://github.com/sendgrid/sendgrid-php/releases/tag/v7.0.0) for details.
|
197 |
+
|
198 |
+
All updates to this library are documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases). You may also subscribe to email [release notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes.
|
199 |
+
|
200 |
+
<a name="roadmap"></a>
|
201 |
+
# Roadmap
|
202 |
+
|
203 |
+
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/pulls). We would love to hear your feedback.
|
204 |
+
|
205 |
+
<a name="contribute"></a>
|
206 |
+
# How to Contribute
|
207 |
+
|
208 |
+
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) guide for details.
|
209 |
+
|
210 |
+
Quick links:
|
211 |
+
|
212 |
+
- [Feature Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#feature_request)
|
213 |
+
- [Bug Reports](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#submit_a_bug_report)
|
214 |
+
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#cla)
|
215 |
+
- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#improvements_to_the_codebase)
|
216 |
+
- [Review Pull Requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#code-reviews)
|
217 |
+
|
218 |
+
<a name="troubleshooting"></a>
|
219 |
+
# Troubleshooting
|
220 |
+
|
221 |
+
Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-php/blob/master/TROUBLESHOOTING.md) for common library issues.
|
222 |
+
|
223 |
+
<a name="about"></a>
|
224 |
+
# About
|
225 |
+
|
226 |
+
sendgrid-php is guided and supported by the Twilio [Developer Experience Team](mailto:dx@sendgrid.com).
|
227 |
+
|
228 |
+
sendgrid-php is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-php are trademarks of Twilio SendGrid, Inc.
|
229 |
+
|
230 |
+
|
231 |
+
# License
|
232 |
+
[The MIT License (MIT)](LICENSE.txt)
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "sendgrid/sendgrid",
|
3 |
+
"description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.",
|
4 |
+
"version": "7.3.0",
|
5 |
+
"homepage": "http://github.com/sendgrid/sendgrid-php",
|
6 |
+
"license": "MIT",
|
7 |
+
"keywords": [
|
8 |
+
"SendGrid",
|
9 |
+
"sendgrid",
|
10 |
+
"Twilio SendGrid",
|
11 |
+
"twilio sendgrid",
|
12 |
+
"email",
|
13 |
+
"send",
|
14 |
+
"grid"
|
15 |
+
],
|
16 |
+
"require": {
|
17 |
+
"php": ">=5.6",
|
18 |
+
"sendgrid/php-http-client": "~3.9",
|
19 |
+
"ext-curl": "*",
|
20 |
+
"ext-json": "*",
|
21 |
+
"ext-mbstring": "*",
|
22 |
+
"ext-openssl": "*"
|
23 |
+
},
|
24 |
+
"require-dev": {
|
25 |
+
"phpunit/phpunit": "^5.7.9 || ^6.4.3",
|
26 |
+
"squizlabs/php_codesniffer": "3.*",
|
27 |
+
"swaggest/json-diff": "^3.4"
|
28 |
+
},
|
29 |
+
"replace": {
|
30 |
+
"sendgrid/sendgrid-php": "*"
|
31 |
+
},
|
32 |
+
"type": "library",
|
33 |
+
"autoload": {
|
34 |
+
"psr-4": {
|
35 |
+
"SendGrid\\": "lib/",
|
36 |
+
"SendGrid\\Mail\\": "lib/mail/",
|
37 |
+
"SendGrid\\Contacts\\": "lib/contacts/",
|
38 |
+
"SendGrid\\Stats\\": "lib/stats/"
|
39 |
+
},
|
40 |
+
"files": ["lib/SendGrid.php"]
|
41 |
+
},
|
42 |
+
"autoload-dev": {
|
43 |
+
"psr-4": {
|
44 |
+
"SendGrid\\Tests\\": "test/"
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/docker/Dockerfile
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM php:7.1-cli
|
2 |
+
|
3 |
+
ENV OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"
|
4 |
+
ENV SENDGRID_API_KEY $SENDGRID_API_KEY
|
5 |
+
|
6 |
+
# install Prism
|
7 |
+
WORKDIR /root
|
8 |
+
|
9 |
+
# install Prism
|
10 |
+
ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh
|
11 |
+
RUN chmod +x ./install.sh && sync && \
|
12 |
+
./install.sh && \
|
13 |
+
rm ./install.sh
|
14 |
+
|
15 |
+
# set up default Twilio SendGrid env
|
16 |
+
WORKDIR /root
|
17 |
+
|
18 |
+
RUN mkdir sendgrid-php
|
19 |
+
COPY entrypoint.sh entrypoint.sh
|
20 |
+
RUN chmod +x entrypoint.sh
|
21 |
+
ENTRYPOINT ["./entrypoint.sh"]
|
22 |
+
CMD ["--mock"]
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/docker/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Use Docker to easily try out or contribute to the sendgrid-php library.
|
2 |
+
|
3 |
+
This Docker image contains:
|
4 |
+
- PHP 7.1.16
|
5 |
+
- A running instance of [Stoplight.io's Prism](https://stoplight.io/platform/prism/), which lets you try out the Twilio SendGrid API without actually sending email
|
6 |
+
- A mirrored copy of sendgrid-php so that you may develop locally and then run the tests within the Docker container.
|
7 |
+
|
8 |
+
# Table of Contents
|
9 |
+
|
10 |
+
* [Quick Start](#quick-start)
|
11 |
+
* [Testing](#testing)
|
12 |
+
* [Contributing](#contributing)
|
13 |
+
|
14 |
+
<a name="quick-start"></a>
|
15 |
+
# Quick Start
|
16 |
+
|
17 |
+
0. Install Composer:
|
18 |
+
- `php -r "readfile('https://getcomposer.org/installer');" | php`
|
19 |
+
- `mv composer.phar /usr/local/bin/composer`
|
20 |
+
1. Clone the sendgrid-php repo
|
21 |
+
- `git clone https://github.com/sendgrid/sendgrid-php.git`
|
22 |
+
- `cd sendgrid-php`
|
23 |
+
- `composer install`
|
24 |
+
2. [Install Docker](https://docs.docker.com/install/)
|
25 |
+
3. [Setup local environment variable SENDGRID_API_KEY](https://github.com/sendgrid/sendgrid-php#setup-environment-variables)
|
26 |
+
4. Build Docker image, run Docker container, login to the Docker container
|
27 |
+
- `docker image build --tag="sendgrid/php7" ./docker`
|
28 |
+
- `docker run -itd --name="sendgrid_php7" -v $(pwd):/root/sendgrid-php sendgrid/php7 /bin/bash`
|
29 |
+
5. Run the tests within the Docker container
|
30 |
+
- `docker exec -it sendgrid_php7 /bin/bash -c 'cd sendgrid-php/test; ../vendor/bin/phpunit . --filter test*; exec "${SHELL:-sh}"'`
|
31 |
+
|
32 |
+
Now you can continue development locally, and run `../vendor/bin/phpunit . --filter test*` inside of the container to test. Replace `test*` with the name of a particular test if you do not wish to run the entire suite of tests.
|
33 |
+
|
34 |
+
To clean up the container: `docker stop sendgrid_php7 && docker rm sendgrid_php7`.
|
35 |
+
|
36 |
+
Happy Hacking!
|
37 |
+
|
38 |
+
<a name="testing"></a>
|
39 |
+
# For Testing the Library (Kick the Tires)
|
40 |
+
|
41 |
+
- After step 5 in the QuickStart, within the Docker container:
|
42 |
+
- `cd ../`
|
43 |
+
- `php sendmail.php`
|
44 |
+
|
45 |
+
<a name="contributing"></a>
|
46 |
+
# For Contributors
|
47 |
+
|
48 |
+
- Develop per usual locally, but before pushing up to GitHub, you can run the tests locally in the Docker container per step 5 of the quickstart.
|
49 |
+
- To run all the tests: `../vendor/bin/phpunit . --filter test*`
|
50 |
+
- To run an individual test: `../vendor/bin/phpunit . --filter [Name of Test]`
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/docker/entrypoint.sh
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#! /bin/bash
|
2 |
+
clear
|
3 |
+
|
4 |
+
if [ "$1" != "--no-mock" ]
|
5 |
+
then
|
6 |
+
echo "Starting Prism in mock mode. Calls made to Prism will not actually send emails."
|
7 |
+
echo "Disable this by running this container with --no-mock."
|
8 |
+
prism run --mock --spec $OAI_SPEC_URL 2> /dev/null &
|
9 |
+
else
|
10 |
+
echo "Starting Prism in live (--no-mock) mode. Calls made to Prism will send emails."
|
11 |
+
prism run --spec $OAI_SPEC_URL 2> /dev/null &
|
12 |
+
fi
|
13 |
+
|
14 |
+
cd sendgrid-php
|
15 |
+
exec $SHELL
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This library allows you to quickly and easily send emails through
|
4 |
+
* Twilio SendGrid using PHP.
|
5 |
+
*
|
6 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
7 |
+
*
|
8 |
+
* @package SendGrid\Tests
|
9 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
10 |
+
* @copyright 2018-19 Twilio SendGrid
|
11 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
12 |
+
* @version GIT: <git_id>
|
13 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* This class is the interface to the Twilio SendGrid Web API
|
18 |
+
*
|
19 |
+
* @package SendGrid\Mail
|
20 |
+
*/
|
21 |
+
class SendGrid
|
22 |
+
{
|
23 |
+
const VERSION = '7.3.0';
|
24 |
+
|
25 |
+
// @var string
|
26 |
+
protected $namespace = 'SendGrid';
|
27 |
+
|
28 |
+
// @var \SendGrid\Client
|
29 |
+
public $client;
|
30 |
+
// @var string
|
31 |
+
public $version = self::VERSION;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Setup the HTTP Client
|
35 |
+
*
|
36 |
+
* @param string $apiKey Your Twilio SendGrid API Key.
|
37 |
+
* @param array $options An array of options, currently only "host", "curl" and
|
38 |
+
* "impersonateSubuser" are implemented.
|
39 |
+
*/
|
40 |
+
public function __construct($apiKey, $options = array())
|
41 |
+
{
|
42 |
+
$headers = array(
|
43 |
+
'Authorization: Bearer '.$apiKey,
|
44 |
+
'User-Agent: sendgrid/' . $this->version . ';php',
|
45 |
+
'Accept: application/json'
|
46 |
+
);
|
47 |
+
|
48 |
+
$host = isset($options['host']) ? $options['host'] :
|
49 |
+
'https://api.sendgrid.com';
|
50 |
+
|
51 |
+
if (!empty($options['impersonateSubuser'])) {
|
52 |
+
$headers[] = 'On-Behalf-Of: '. $options['impersonateSubuser'];
|
53 |
+
}
|
54 |
+
|
55 |
+
$curlOptions = isset($options['curl']) ? $options['curl'] : null;
|
56 |
+
|
57 |
+
$this->client = new \SendGrid\Client(
|
58 |
+
$host,
|
59 |
+
$headers,
|
60 |
+
'/v3',
|
61 |
+
null,
|
62 |
+
$curlOptions
|
63 |
+
);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Make an API request
|
68 |
+
*
|
69 |
+
* @param \SendGrid\Mail\Mail $email A Mail object, containing the request object
|
70 |
+
*
|
71 |
+
* @return \SendGrid\Response
|
72 |
+
*/
|
73 |
+
public function send(\SendGrid\Mail\Mail $email)
|
74 |
+
{
|
75 |
+
return $this->client->mail()->send()->post($email);
|
76 |
+
}
|
77 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/contacts/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Recipients Helper
|
2 |
+
|
3 |
+
**This helper allows you to quickly and easily build a subscription form to add contacts to your contactdb in Sendgrid.**
|
4 |
+
|
5 |
+
## Quick Start
|
6 |
+
|
7 |
+
Run the [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/contacts/recipients.php) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
|
8 |
+
|
9 |
+
```bash
|
10 |
+
php examples/helpers/contacts/recipients.php
|
11 |
+
```
|
12 |
+
|
13 |
+
## Usage
|
14 |
+
|
15 |
+
- See this complete working [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/contacts/recipients.php).
|
16 |
+
- [Documentation](https://sendgrid.com/docs/API_Reference/api_v3.html#contacts-api-recipients)
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/contacts/Recipient.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds a recipient for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Contacts
|
8 |
+
* @author Kraig Hufstedler <kraigory@gmail.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Contacts;
|
16 |
+
/**
|
17 |
+
* This class is used to construct a recipient for the /mail/send API call
|
18 |
+
*
|
19 |
+
* @package SendGrid\Mail
|
20 |
+
*/
|
21 |
+
class Recipient implements \JsonSerializable
|
22 |
+
{
|
23 |
+
/** @var $firstName string First name of the email recipient */
|
24 |
+
private $firstName;
|
25 |
+
/** @var $lastName string Last name of the email recipient */
|
26 |
+
private $lastName;
|
27 |
+
/** @var $email string Email address of the recipient */
|
28 |
+
private $email;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Create a recipient for the /mail/send API call
|
32 |
+
*
|
33 |
+
* @param string $firstName First name of the email recipient
|
34 |
+
* @param string $lastName Last name of the email recipient
|
35 |
+
* @param string $email Email address of the recipient
|
36 |
+
*/
|
37 |
+
public function __construct($firstName, $lastName, $email)
|
38 |
+
{
|
39 |
+
$this->firstName = $firstName;
|
40 |
+
$this->lastName = $lastName;
|
41 |
+
$this->email = $email;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Retrieve the first name of the recipient
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getFirstName()
|
50 |
+
{
|
51 |
+
return $this->firstName;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve the last name of the recipient
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function getLastName()
|
60 |
+
{
|
61 |
+
return $this->lastName;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Retrieve the email address of the recipient
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getEmail()
|
70 |
+
{
|
71 |
+
return $this->email;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Return an array representing a recipient object for the Twilio SendGrid API
|
76 |
+
*
|
77 |
+
* @return null|array
|
78 |
+
*/
|
79 |
+
public function jsonSerialize()
|
80 |
+
{
|
81 |
+
return array_filter(
|
82 |
+
[
|
83 |
+
'email' => $this->getEmail(),
|
84 |
+
'first_name' => $this->getFirstName(),
|
85 |
+
'last_name' => $this->getLastName()
|
86 |
+
],
|
87 |
+
function ($value) {
|
88 |
+
return $value !== null;
|
89 |
+
}
|
90 |
+
) ?: null;
|
91 |
+
}
|
92 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/contacts/RecipientForm.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds a html form and provides a submission endpoint
|
4 |
+
* for the form that makes a /contactdb/recipients API call.
|
5 |
+
*
|
6 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
7 |
+
*
|
8 |
+
* @package SendGrid\Contacts
|
9 |
+
* @author Kraig Hufstedler <kraigory@gmail.com>
|
10 |
+
* @copyright 2018-19 Twilio SendGrid
|
11 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
12 |
+
* @version GIT: <git_id>
|
13 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
14 |
+
*/
|
15 |
+
|
16 |
+
namespace SendGrid\Contacts;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class is used to build a html form and provides a submission
|
20 |
+
* endpoint for the form that makes a /contactdb/recipients API call.
|
21 |
+
*
|
22 |
+
* @package SendGrid\Contacts
|
23 |
+
*/
|
24 |
+
class RecipientForm
|
25 |
+
{
|
26 |
+
/** @var $html string HTML content for the form */
|
27 |
+
private $html;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Form constructor
|
31 |
+
*
|
32 |
+
* @param string $url The url the form should submit to
|
33 |
+
*/
|
34 |
+
public function __construct($url)
|
35 |
+
{
|
36 |
+
$html = '<form action="' . $url . '" method="post">
|
37 |
+
First Name: <input type="text" name="first-name"><br>
|
38 |
+
Last Name: <input type="text" name="last-name"><br>
|
39 |
+
E-mail: <input type="text" name="email"><br>
|
40 |
+
<input type="submit">
|
41 |
+
</form>';
|
42 |
+
$this->html = $html;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Return the HTML form
|
47 |
+
*
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
public function __toString()
|
51 |
+
{
|
52 |
+
return $this->html;
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Allows us to include one file instead of two when working without composer.
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
require_once __DIR__ . '/SendGrid.php';
|
15 |
+
require_once __DIR__ . '/contacts/Recipient.php';
|
16 |
+
require_once __DIR__ . '/contacts/RecipientForm.php';
|
17 |
+
require_once __DIR__ . '/mail/EmailAddress.php';
|
18 |
+
require_once __DIR__ . '/mail/Asm.php';
|
19 |
+
require_once __DIR__ . '/mail/Attachment.php';
|
20 |
+
require_once __DIR__ . '/mail/BatchId.php';
|
21 |
+
require_once __DIR__ . '/mail/Bcc.php';
|
22 |
+
require_once __DIR__ . '/mail/BccSettings.php';
|
23 |
+
require_once __DIR__ . '/mail/BypassListManagement.php';
|
24 |
+
require_once __DIR__ . '/mail/Category.php';
|
25 |
+
require_once __DIR__ . '/mail/Cc.php';
|
26 |
+
require_once __DIR__ . '/mail/ClickTracking.php';
|
27 |
+
require_once __DIR__ . '/mail/Content.php';
|
28 |
+
require_once __DIR__ . '/mail/CustomArg.php';
|
29 |
+
require_once __DIR__ . '/mail/Footer.php';
|
30 |
+
require_once __DIR__ . '/mail/From.php';
|
31 |
+
require_once __DIR__ . '/mail/Ganalytics.php';
|
32 |
+
require_once __DIR__ . '/mail/GroupId.php';
|
33 |
+
require_once __DIR__ . '/mail/GroupsToDisplay.php';
|
34 |
+
require_once __DIR__ . '/mail/Header.php';
|
35 |
+
require_once __DIR__ . '/mail/HtmlContent.php';
|
36 |
+
require_once __DIR__ . '/mail/IpPoolName.php';
|
37 |
+
require_once __DIR__ . '/mail/Mail.php';
|
38 |
+
require_once __DIR__ . '/mail/MailSettings.php';
|
39 |
+
require_once __DIR__ . '/mail/MimeType.php';
|
40 |
+
require_once __DIR__ . '/mail/OpenTracking.php';
|
41 |
+
require_once __DIR__ . '/mail/Personalization.php';
|
42 |
+
require_once __DIR__ . '/mail/PlainTextContent.php';
|
43 |
+
require_once __DIR__ . '/mail/ReplyTo.php';
|
44 |
+
require_once __DIR__ . '/mail/Section.php';
|
45 |
+
require_once __DIR__ . '/mail/SandBoxMode.php';
|
46 |
+
require_once __DIR__ . '/mail/SendAt.php';
|
47 |
+
require_once __DIR__ . '/mail/SpamCheck.php';
|
48 |
+
require_once __DIR__ . '/mail/Subject.php';
|
49 |
+
require_once __DIR__ . '/mail/SubscriptionTracking.php';
|
50 |
+
require_once __DIR__ . '/mail/Substitution.php';
|
51 |
+
require_once __DIR__ . '/mail/TemplateId.php';
|
52 |
+
require_once __DIR__ . '/mail/TrackingSettings.php';
|
53 |
+
require_once __DIR__ . '/mail/To.php';
|
54 |
+
require_once __DIR__ . '/stats/Stats.php';
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Asm.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Asm object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Asm object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Asm implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $group_id int The unsubscribe group to associate with this email */
|
25 |
+
private $group_id;
|
26 |
+
/**
|
27 |
+
* @var $groups_to_display int[] An array containing the unsubscribe groups that you
|
28 |
+
* would like to be displayed on the unsubscribe preferences page.
|
29 |
+
*/
|
30 |
+
private $groups_to_display;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Optional constructor
|
34 |
+
*
|
35 |
+
* @param int|GroupId|null $group_id A GroupId object or the
|
36 |
+
* unsubscribe group to
|
37 |
+
* associate with this email
|
38 |
+
* @param int[]|GroupsToDisplay|null $groups_to_display A GroupsToDisplay
|
39 |
+
* object or an array
|
40 |
+
* containing the
|
41 |
+
* unsubscribe groups
|
42 |
+
* that you would like
|
43 |
+
* to be displayed
|
44 |
+
* on the unsubscribe
|
45 |
+
* preferences page.
|
46 |
+
*/
|
47 |
+
public function __construct(
|
48 |
+
$group_id = null,
|
49 |
+
$groups_to_display = null
|
50 |
+
) {
|
51 |
+
if (isset($group_id)) {
|
52 |
+
$this->setGroupId($group_id);
|
53 |
+
}
|
54 |
+
if (isset($groups_to_display)) {
|
55 |
+
$this->setGroupsToDisplay($groups_to_display);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Add the group id to a Asm object
|
61 |
+
*
|
62 |
+
* @param int|GroupId $group_id The unsubscribe group to associate with this
|
63 |
+
* email
|
64 |
+
*
|
65 |
+
* @throws TypeException
|
66 |
+
*/
|
67 |
+
public function setGroupId($group_id)
|
68 |
+
{
|
69 |
+
if ($group_id instanceof GroupId) {
|
70 |
+
$this->group_id = $group_id->getGroupId();
|
71 |
+
} else {
|
72 |
+
if (!is_int($group_id)) {
|
73 |
+
throw new TypeException(
|
74 |
+
'$group_id must be an instance of Twilio SendGrid\Mail\GroupId or of type int.'
|
75 |
+
);
|
76 |
+
}
|
77 |
+
$this->group_id = new GroupId($group_id);
|
78 |
+
}
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Retrieve the GroupId object from a Asm object
|
84 |
+
*
|
85 |
+
* The unsubscribe group to associate with this email
|
86 |
+
*
|
87 |
+
* @return int
|
88 |
+
*/
|
89 |
+
public function getGroupId()
|
90 |
+
{
|
91 |
+
return $this->group_id;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Add the groups to display id(s) to a Asm object
|
96 |
+
*
|
97 |
+
* @param int[]|GroupsToDisplay $groups_to_display A GroupsToDisplay
|
98 |
+
* object or an array
|
99 |
+
* containing the
|
100 |
+
* unsubscribe groups
|
101 |
+
* that you would like
|
102 |
+
* to be displayed
|
103 |
+
* on the unsubscribe
|
104 |
+
* preferences page.
|
105 |
+
*
|
106 |
+
* @throws TypeException
|
107 |
+
*/
|
108 |
+
public function setGroupsToDisplay($groups_to_display)
|
109 |
+
{
|
110 |
+
if ($groups_to_display instanceof GroupsToDisplay) {
|
111 |
+
$this->groups_to_display = $groups_to_display->getGroupsToDisplay();
|
112 |
+
} else {
|
113 |
+
if (!is_array($groups_to_display)) {
|
114 |
+
throw new TypeException(
|
115 |
+
'$groups_to_display must be an instance of Twilio SendGrid\Mail\GroupsToDisplay or of type array.'
|
116 |
+
);
|
117 |
+
}
|
118 |
+
$this->groups_to_display = new GroupsToDisplay($groups_to_display);
|
119 |
+
}
|
120 |
+
return;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Retrieve the groups to display id(s) from a Asm object
|
125 |
+
*
|
126 |
+
* @return int[]
|
127 |
+
*/
|
128 |
+
public function getGroupsToDisplay()
|
129 |
+
{
|
130 |
+
return $this->groups_to_display;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Return an array representing a Asm object for the Twilio SendGrid API
|
135 |
+
*
|
136 |
+
* @return null|array
|
137 |
+
*/
|
138 |
+
public function jsonSerialize()
|
139 |
+
{
|
140 |
+
return array_filter(
|
141 |
+
[
|
142 |
+
'group_id' => $this->getGroupId(),
|
143 |
+
'groups_to_display' => $this->getGroupsToDisplay()
|
144 |
+
],
|
145 |
+
function ($value) {
|
146 |
+
return $value !== null;
|
147 |
+
}
|
148 |
+
) ?: null;
|
149 |
+
}
|
150 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Attachment.php
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Attachment object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Attachment object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Attachment implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $content string Base64 encoded content */
|
25 |
+
private $content;
|
26 |
+
/** @var $type string Mime type of the attachment */
|
27 |
+
private $type;
|
28 |
+
/** @var $filename string File name of the attachment */
|
29 |
+
private $filename;
|
30 |
+
/** @var $disposition string How the attachment should be displayed: inline or attachment, default is attachment */
|
31 |
+
private $disposition;
|
32 |
+
/** @var $content_id string Used when disposition is inline to diplay the file within the body of the email */
|
33 |
+
private $content_id;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Optional constructor
|
37 |
+
*
|
38 |
+
* @param string $content Base64 encoded content
|
39 |
+
* @param string $type Mime type of the attachment
|
40 |
+
* @param string $filename File name of the attachment
|
41 |
+
* @param string $disposition How the attachment should be displayed: inline
|
42 |
+
* or attachment, default is attachment
|
43 |
+
* @param string $content_id Used when disposition is inline to diplay the
|
44 |
+
* file within the body of the email
|
45 |
+
*/
|
46 |
+
public function __construct(
|
47 |
+
$content = null,
|
48 |
+
$type = null,
|
49 |
+
$filename = null,
|
50 |
+
$disposition = null,
|
51 |
+
$content_id = null
|
52 |
+
) {
|
53 |
+
if (isset($content)) {
|
54 |
+
$this->setContent($content);
|
55 |
+
}
|
56 |
+
if (isset($type)) {
|
57 |
+
$this->setType($type);
|
58 |
+
}
|
59 |
+
if (isset($filename)) {
|
60 |
+
$this->setFilename($filename);
|
61 |
+
}
|
62 |
+
if (isset($disposition)) {
|
63 |
+
$this->setDisposition($disposition);
|
64 |
+
}
|
65 |
+
if (isset($content_id)) {
|
66 |
+
$this->setContentID($content_id);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Add the content to a Attachment object
|
72 |
+
*
|
73 |
+
* @param string $content Base64 encoded content
|
74 |
+
*
|
75 |
+
* @throws TypeException
|
76 |
+
*/
|
77 |
+
public function setContent($content)
|
78 |
+
{
|
79 |
+
if (!is_string($content)) {
|
80 |
+
throw new TypeException('$content must be of type string.');
|
81 |
+
}
|
82 |
+
if (!$this->isBase64($content)) {
|
83 |
+
$this->content = base64_encode($content);
|
84 |
+
} else {
|
85 |
+
$this->content = $content;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retrieve the content from a Attachment object
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
public function getContent()
|
95 |
+
{
|
96 |
+
return $this->content;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Add the mime type to a Attachment object
|
101 |
+
*
|
102 |
+
* @param string $type Mime type of the attachment
|
103 |
+
*
|
104 |
+
* @throws TypeException
|
105 |
+
*/
|
106 |
+
public function setType($type)
|
107 |
+
{
|
108 |
+
if (!is_string($type)) {
|
109 |
+
throw new TypeException('$type must be of type string.');
|
110 |
+
}
|
111 |
+
$this->type = $type;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Retrieve the mime type from a Attachment object
|
116 |
+
*
|
117 |
+
* @return string
|
118 |
+
*/
|
119 |
+
public function getType()
|
120 |
+
{
|
121 |
+
return $this->type;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Add the file name to a Attachment object
|
126 |
+
*
|
127 |
+
* @param string $filename File name of the attachment
|
128 |
+
*
|
129 |
+
* @throws TypeException
|
130 |
+
*/
|
131 |
+
public function setFilename($filename)
|
132 |
+
{
|
133 |
+
if (!is_string($filename)) {
|
134 |
+
throw new TypeException('$filename must be of type string');
|
135 |
+
}
|
136 |
+
$this->filename = $filename;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Retrieve the file name from a Attachment object
|
141 |
+
*
|
142 |
+
* @return string
|
143 |
+
*/
|
144 |
+
public function getFilename()
|
145 |
+
{
|
146 |
+
return $this->filename;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Add the disposition to a Attachment object
|
151 |
+
*
|
152 |
+
* @param string $disposition How the attachment should be displayed:
|
153 |
+
* inline or attachment, default is attachment
|
154 |
+
*
|
155 |
+
* @throws TypeException
|
156 |
+
*/
|
157 |
+
public function setDisposition($disposition)
|
158 |
+
{
|
159 |
+
if (!is_string($disposition)) {
|
160 |
+
throw new TypeException('$disposition must be of type string.');
|
161 |
+
}
|
162 |
+
$this->disposition = $disposition;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Retrieve the disposition from a Attachment object
|
167 |
+
*
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
public function getDisposition()
|
171 |
+
{
|
172 |
+
return $this->disposition;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Add the content id to a Attachment object
|
177 |
+
*
|
178 |
+
* @param string $content_id Used when disposition is inline to diplay
|
179 |
+
* the file within the body of the email
|
180 |
+
*/
|
181 |
+
public function setContentID($content_id)
|
182 |
+
{
|
183 |
+
if (!is_string($content_id)) {
|
184 |
+
throw new TypeException('$content_id must be of type string.');
|
185 |
+
}
|
186 |
+
$this->content_id = $content_id;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Retrieve the content id from a Attachment object
|
191 |
+
*
|
192 |
+
* @return string
|
193 |
+
*/
|
194 |
+
public function getContentID()
|
195 |
+
{
|
196 |
+
return $this->content_id;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Verifies whether or not the provided string is a valid base64 string
|
201 |
+
*
|
202 |
+
* @param $string string The string that has to be checked
|
203 |
+
* @return bool
|
204 |
+
*/
|
205 |
+
private function isBase64($string)
|
206 |
+
{
|
207 |
+
$decoded_data = base64_decode($string, true);
|
208 |
+
$encoded_data = base64_encode($decoded_data);
|
209 |
+
if ($encoded_data != $string) {
|
210 |
+
return false;
|
211 |
+
}
|
212 |
+
return true;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Return an array representing a Attachment object for the Twilio SendGrid API
|
217 |
+
*
|
218 |
+
* @return null|array
|
219 |
+
*/
|
220 |
+
public function jsonSerialize()
|
221 |
+
{
|
222 |
+
return array_filter(
|
223 |
+
[
|
224 |
+
'content' => $this->getContent(),
|
225 |
+
'type' => $this->getType(),
|
226 |
+
'filename' => $this->getFilename(),
|
227 |
+
'disposition' => $this->getDisposition(),
|
228 |
+
'content_id' => $this->getContentID()
|
229 |
+
],
|
230 |
+
function ($value) {
|
231 |
+
return $value !== null;
|
232 |
+
}
|
233 |
+
) ?: null;
|
234 |
+
}
|
235 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/BatchId.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the BatchId object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a BatchId object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class BatchId implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $batch_id string This ID represents a batch of emails to be sent at the same time */
|
25 |
+
private $batch_id;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Optional constructor
|
29 |
+
*
|
30 |
+
* @param string|null $batch_id This ID represents a batch of emails to
|
31 |
+
* be sent at the same time
|
32 |
+
*/
|
33 |
+
public function __construct($batch_id = null)
|
34 |
+
{
|
35 |
+
if (isset($batch_id)) {
|
36 |
+
$this->setBatchId($batch_id);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Add the batch id to a BatchId object
|
42 |
+
*
|
43 |
+
* @param string $batch_id This ID represents a batch of emails to be sent
|
44 |
+
* at the same time
|
45 |
+
*
|
46 |
+
* @throws TypeException
|
47 |
+
*/
|
48 |
+
public function setBatchId($batch_id)
|
49 |
+
{
|
50 |
+
if (!is_string($batch_id)) {
|
51 |
+
throw new TypeException('$batch_id must be of type string.');
|
52 |
+
}
|
53 |
+
$this->batch_id = $batch_id;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Return the batch id from a BatchId object
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function getBatchId()
|
62 |
+
{
|
63 |
+
return $this->batch_id;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Return an array representing a BatchId object for the Twilio SendGrid API
|
68 |
+
*
|
69 |
+
* @return null|string
|
70 |
+
*/
|
71 |
+
public function jsonSerialize()
|
72 |
+
{
|
73 |
+
return $this->getBatchId();
|
74 |
+
}
|
75 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Bcc.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Bcc object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Bcc object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Bcc extends EmailAddress implements \JsonSerializable
|
23 |
+
{
|
24 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/BccSettings.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the BccSettings object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a BccSettings object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class BccSettings implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
25 |
+
private $enable;
|
26 |
+
/** @var $email string The email address that you would like to receive the BCC */
|
27 |
+
private $email;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Optional constructor
|
31 |
+
*
|
32 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
33 |
+
* @param string|null $email The email address that you would like
|
34 |
+
* to receive the BCC
|
35 |
+
*/
|
36 |
+
public function __construct($enable = null, $email = null)
|
37 |
+
{
|
38 |
+
if (isset($enable)) {
|
39 |
+
$this->setEnable($enable);
|
40 |
+
}
|
41 |
+
if (isset($email)) {
|
42 |
+
$this->setEmail($email);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Update the enable setting on a BccSettings object
|
48 |
+
*
|
49 |
+
* @param bool $enable Indicates if this setting is enabled
|
50 |
+
*
|
51 |
+
* @throws TypeException
|
52 |
+
*/
|
53 |
+
public function setEnable($enable)
|
54 |
+
{
|
55 |
+
if (!is_bool($enable)) {
|
56 |
+
throw new TypeException('$enable must be of type bool.');
|
57 |
+
}
|
58 |
+
$this->enable = $enable;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve the enable setting on a BccSettings object
|
63 |
+
*
|
64 |
+
* @return bool
|
65 |
+
*/
|
66 |
+
public function getEnable()
|
67 |
+
{
|
68 |
+
return $this->enable;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Add the email setting on a BccSettings object
|
73 |
+
*
|
74 |
+
* @param string $email The email address that you would like
|
75 |
+
* to receive the BCC
|
76 |
+
*
|
77 |
+
* @throws TypeException
|
78 |
+
*/
|
79 |
+
public function setEmail($email)
|
80 |
+
{
|
81 |
+
if (!is_string($email) &&
|
82 |
+
filter_var($email, FILTER_VALIDATE_EMAIL)
|
83 |
+
) {
|
84 |
+
throw new TypeException(
|
85 |
+
'$email must valid and be of type string.'
|
86 |
+
);
|
87 |
+
}
|
88 |
+
$this->email = $email;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Retrieve the email setting on a BccSettings object
|
93 |
+
*
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function getEmail()
|
97 |
+
{
|
98 |
+
return $this->email;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Return an array representing a BccSettings object for the Twilio SendGrid API
|
103 |
+
*
|
104 |
+
* @return null|array
|
105 |
+
*/
|
106 |
+
public function jsonSerialize()
|
107 |
+
{
|
108 |
+
return array_filter(
|
109 |
+
[
|
110 |
+
'enable' => $this->getEnable(),
|
111 |
+
'email' => $this->getEmail()
|
112 |
+
],
|
113 |
+
function ($value) {
|
114 |
+
return $value !== null;
|
115 |
+
}
|
116 |
+
) ?: null;
|
117 |
+
}
|
118 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/BypassListManagement.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the BypassListManagement object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a BypassListManagement object for
|
19 |
+
* the /mail/send API call
|
20 |
+
*
|
21 |
+
* Allows you to bypass all unsubscribe groups and suppressions to
|
22 |
+
* ensure that the email is delivered to every single recipient. This
|
23 |
+
* should only be used in emergencies when it is absolutely necessary
|
24 |
+
* that every recipient receives your email
|
25 |
+
*
|
26 |
+
* @package SendGrid\Mail
|
27 |
+
*/
|
28 |
+
class BypassListManagement implements \JsonSerializable
|
29 |
+
{
|
30 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
31 |
+
private $enable;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Optional constructor
|
35 |
+
*
|
36 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
37 |
+
*/
|
38 |
+
public function __construct($enable = null)
|
39 |
+
{
|
40 |
+
if (isset($enable)) {
|
41 |
+
$this->setEnable($enable);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Update the enable setting on a BypassListManagement object
|
47 |
+
*
|
48 |
+
* @param bool $enable Indicates if this setting is enabled
|
49 |
+
*
|
50 |
+
* @throws TypeException
|
51 |
+
*/
|
52 |
+
public function setEnable($enable)
|
53 |
+
{
|
54 |
+
if (!is_bool($enable)) {
|
55 |
+
throw new TypeException('$enable must be of type bool.');
|
56 |
+
}
|
57 |
+
$this->enable = $enable;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Retrieve the enable setting on a BypassListManagement object
|
62 |
+
*
|
63 |
+
* @return bool
|
64 |
+
*/
|
65 |
+
public function getEnable()
|
66 |
+
{
|
67 |
+
return $this->enable;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Return an array representing a BypassListManagement object for
|
72 |
+
* the SendGrid API
|
73 |
+
*
|
74 |
+
* @return null|array
|
75 |
+
*/
|
76 |
+
public function jsonSerialize()
|
77 |
+
{
|
78 |
+
return array_filter(
|
79 |
+
[
|
80 |
+
'enable' => $this->getEnable()
|
81 |
+
],
|
82 |
+
function ($value) {
|
83 |
+
return $value !== null;
|
84 |
+
}
|
85 |
+
) ?: null;
|
86 |
+
}
|
87 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Category.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Category object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Category object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Category implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $category string A category name for an email message. Each category name may not exceed 255 characters */
|
25 |
+
private $category;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Optional constructor
|
29 |
+
*
|
30 |
+
* @param string|null $category A category name for an email message.
|
31 |
+
* Each category name may not exceed 255
|
32 |
+
* characters
|
33 |
+
*/
|
34 |
+
public function __construct($category = null)
|
35 |
+
{
|
36 |
+
if (isset($category)) {
|
37 |
+
$this->setCategory($category);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Add a category to a Category object
|
43 |
+
*
|
44 |
+
* @param string $category A category name for an email message.
|
45 |
+
* Each category name may not exceed 255
|
46 |
+
* characters
|
47 |
+
*
|
48 |
+
* @throws TypeException
|
49 |
+
*/
|
50 |
+
public function setCategory($category)
|
51 |
+
{
|
52 |
+
if (!is_string($category)) {
|
53 |
+
throw new TypeException('$category must be of type string.');
|
54 |
+
}
|
55 |
+
$this->category = $category;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Retrieve a category from a Category object
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getCategory()
|
64 |
+
{
|
65 |
+
return $this->category;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Return an array representing a Category object for the Twilio SendGrid API
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function jsonSerialize()
|
74 |
+
{
|
75 |
+
return $this->getCategory();
|
76 |
+
}
|
77 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Cc.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Cc object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Cc object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Cc extends EmailAddress implements \JsonSerializable
|
23 |
+
{
|
24 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/ClickTracking.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the ClickTracking object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a ClickTracking object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class ClickTracking implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
25 |
+
private $enable;
|
26 |
+
/* @var $enable_text bool Indicates if this setting should be included in the text/plain portion of your email */
|
27 |
+
private $enable_text;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Optional constructor
|
31 |
+
*
|
32 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
33 |
+
* @param bool|null $enable_text Indicates if this setting should be
|
34 |
+
* included in the text/plain portion of
|
35 |
+
* your email
|
36 |
+
*/
|
37 |
+
public function __construct($enable = null, $enable_text = null)
|
38 |
+
{
|
39 |
+
if (isset($enable)) {
|
40 |
+
$this->setEnable($enable);
|
41 |
+
}
|
42 |
+
if (isset($enable_text)) {
|
43 |
+
$this->setEnableText($enable_text);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Update the enable setting on a ClickTracking object
|
49 |
+
*
|
50 |
+
* @param bool $enable Indicates if this setting is enabled
|
51 |
+
*
|
52 |
+
* @throws TypeException
|
53 |
+
*/
|
54 |
+
public function setEnable($enable)
|
55 |
+
{
|
56 |
+
if (!is_bool($enable)) {
|
57 |
+
throw new TypeException('$enable must be of type bool.');
|
58 |
+
}
|
59 |
+
$this->enable = $enable;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Retrieve the enable setting on a ClickTracking object
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
public function getEnable()
|
68 |
+
{
|
69 |
+
return $this->enable;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Update the enable text setting on a ClickTracking object
|
74 |
+
*
|
75 |
+
* @param bool $enable_text Indicates if this setting is enabled
|
76 |
+
*
|
77 |
+
* @throws TypeException
|
78 |
+
*/
|
79 |
+
public function setEnableText($enable_text)
|
80 |
+
{
|
81 |
+
if (!is_bool($enable_text)) {
|
82 |
+
throw new TypeException('$enable_text must be of type bool');
|
83 |
+
}
|
84 |
+
$this->enable_text = $enable_text;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Retrieve the enable_text setting on a ClickTracking object
|
89 |
+
*
|
90 |
+
* @return bool
|
91 |
+
*/
|
92 |
+
public function getEnableText()
|
93 |
+
{
|
94 |
+
return $this->enable_text;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Return an array representing a ClickTracking object for the Twilio SendGrid API
|
99 |
+
*
|
100 |
+
* @return null|array
|
101 |
+
*/
|
102 |
+
public function jsonSerialize()
|
103 |
+
{
|
104 |
+
return array_filter(
|
105 |
+
[
|
106 |
+
'enable' => $this->getEnable(),
|
107 |
+
'enable_text' => $this->getEnableText()
|
108 |
+
],
|
109 |
+
function ($value) {
|
110 |
+
return $value !== null;
|
111 |
+
}
|
112 |
+
) ?: null;
|
113 |
+
}
|
114 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Content.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Content object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Content object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Content implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $type string The mime type of the content you are including in your email. For example, “text/plain” or “text/html” */
|
25 |
+
private $type;
|
26 |
+
/** @var $value string The actual content of the specified mime type that you are including in your email */
|
27 |
+
private $value;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Optional constructor
|
31 |
+
*
|
32 |
+
* @param string|null $type The mime type of the content you are including
|
33 |
+
* in your email. For example, “text/plain” or
|
34 |
+
* “text/html”
|
35 |
+
* @param string|null $value The actual content of the specified mime type
|
36 |
+
* that you are including in your email
|
37 |
+
*/
|
38 |
+
public function __construct($type = null, $value = null)
|
39 |
+
{
|
40 |
+
if (isset($type)) {
|
41 |
+
$this->setType($type);
|
42 |
+
}
|
43 |
+
if (isset($value)) {
|
44 |
+
$this->setValue($value);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Add the mime type on a Content object
|
50 |
+
*
|
51 |
+
* @param string $type The mime type of the content you are including
|
52 |
+
* in your email. For example, “text/plain” or
|
53 |
+
* “text/html”
|
54 |
+
*
|
55 |
+
* @throws TypeException
|
56 |
+
*/
|
57 |
+
public function setType($type)
|
58 |
+
{
|
59 |
+
if (!is_string($type)) {
|
60 |
+
throw new TypeException('$type must be of type string.');
|
61 |
+
}
|
62 |
+
$this->type = $type;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Retrieve the mime type on a Content object
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
public function getType()
|
71 |
+
{
|
72 |
+
return $this->type;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Add the content value to a Content object
|
77 |
+
*
|
78 |
+
* @param string $value The actual content of the specified mime type
|
79 |
+
* that you are including in your email
|
80 |
+
*
|
81 |
+
* @throws TypeException
|
82 |
+
*/
|
83 |
+
public function setValue($value)
|
84 |
+
{
|
85 |
+
if (!is_string($value)) {
|
86 |
+
throw new TypeException('$value must be of type string');
|
87 |
+
}
|
88 |
+
$this->value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Retrieve the content value to a Content object
|
93 |
+
*
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function getValue()
|
97 |
+
{
|
98 |
+
return $this->value;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Return an array representing a Contact object for the Twilio SendGrid API
|
103 |
+
*
|
104 |
+
* @return null|array
|
105 |
+
*/
|
106 |
+
public function jsonSerialize()
|
107 |
+
{
|
108 |
+
return array_filter(
|
109 |
+
[
|
110 |
+
'type' => $this->getType(),
|
111 |
+
'value' => $this->getValue()
|
112 |
+
],
|
113 |
+
function ($value) {
|
114 |
+
return $value !== null;
|
115 |
+
}
|
116 |
+
) ?: null;
|
117 |
+
}
|
118 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/CustomArg.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the CustomArg object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a CustomArg object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* Values that are specific to the entire send that will be carried along with the
|
21 |
+
* email and its activity data. Substitutions will not be made on custom arguments,
|
22 |
+
* so any string that is entered into this parameter will be assumed to be the
|
23 |
+
* custom argument that you would like to be used. This parameter is overridden by
|
24 |
+
* personalizations[x].custom_args if that parameter has been defined. Total custom
|
25 |
+
* args size may not exceed 10,000 bytes.
|
26 |
+
*
|
27 |
+
* @package SendGrid\Mail
|
28 |
+
*/
|
29 |
+
class CustomArg implements \JsonSerializable
|
30 |
+
{
|
31 |
+
/** @var $key string Custom arg key */
|
32 |
+
private $key;
|
33 |
+
/** @var $value string Custom arg value */
|
34 |
+
private $value;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Optional constructor
|
38 |
+
*
|
39 |
+
* @param string|null $key Custom arg key
|
40 |
+
* @param string|null $value Custom arg value
|
41 |
+
*/
|
42 |
+
public function __construct($key = null, $value = null)
|
43 |
+
{
|
44 |
+
if (isset($key)) {
|
45 |
+
$this->setKey($key);
|
46 |
+
}
|
47 |
+
if (isset($value)) {
|
48 |
+
$this->setValue($value);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Add a custom arg key on a CustomArg object
|
54 |
+
*
|
55 |
+
* @param string $key Custom arg key
|
56 |
+
*
|
57 |
+
* @throws TypeException
|
58 |
+
*/
|
59 |
+
public function setKey($key)
|
60 |
+
{
|
61 |
+
if (!is_string($key)) {
|
62 |
+
throw new TypeException('$key must be of type string');
|
63 |
+
}
|
64 |
+
$this->key = (string) $key;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Retrieve a custom arg key on a CustomArg object
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function getKey()
|
73 |
+
{
|
74 |
+
return $this->key;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Add a custom arg value on a CustomArg object
|
79 |
+
*
|
80 |
+
* @param string $value Custom arg value
|
81 |
+
*
|
82 |
+
* @throws TypeException
|
83 |
+
*/
|
84 |
+
public function setValue($value)
|
85 |
+
{
|
86 |
+
if (!is_string($value)) {
|
87 |
+
throw new TypeException('$value must be of type string.');
|
88 |
+
}
|
89 |
+
$this->value = (string) $value;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Retrieve a custom arg key on a CustomArg object
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getValue()
|
98 |
+
{
|
99 |
+
return $this->value;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Return an array representing a CustomArg object for the Twilio SendGrid API
|
104 |
+
*
|
105 |
+
* @return null|array
|
106 |
+
*/
|
107 |
+
public function jsonSerialize()
|
108 |
+
{
|
109 |
+
return array_filter(
|
110 |
+
[
|
111 |
+
'key' => $this->getKey(),
|
112 |
+
'value' => $this->getValue()
|
113 |
+
],
|
114 |
+
function ($value) {
|
115 |
+
return $value !== null;
|
116 |
+
}
|
117 |
+
) ?: null;
|
118 |
+
}
|
119 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/EmailAddress.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the EmailAddress object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a EmailAddress object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class EmailAddress implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $name string The name of the person associated with the email */
|
25 |
+
private $name;
|
26 |
+
/** @var $email string The email address */
|
27 |
+
private $email;
|
28 |
+
/** @var $substitutions Substitution[] An array of key/value substitutions to be be applied to the text and html content of the email body */
|
29 |
+
private $substitutions;
|
30 |
+
/** @var $subject Subject The personalized subject of the email */
|
31 |
+
private $subject;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Optional constructor
|
35 |
+
*
|
36 |
+
* @param string|null $emailAddress The email address
|
37 |
+
* @param string|null $name The name of the person associated with
|
38 |
+
* the email
|
39 |
+
* @param array|null $substitutions An array of key/value substitutions to
|
40 |
+
* be be applied to the text and html content
|
41 |
+
* of the email body
|
42 |
+
* @param string|null $subject The personalized subject of the email
|
43 |
+
*/
|
44 |
+
public function __construct(
|
45 |
+
$emailAddress = null,
|
46 |
+
$name = null,
|
47 |
+
$substitutions = null,
|
48 |
+
$subject = null
|
49 |
+
) {
|
50 |
+
if (isset($emailAddress)) {
|
51 |
+
$this->setEmailAddress($emailAddress);
|
52 |
+
}
|
53 |
+
if (isset($name) && $name !== null) {
|
54 |
+
$this->setName($name);
|
55 |
+
}
|
56 |
+
if (isset($substitutions)) {
|
57 |
+
$this->setSubstitutions($substitutions);
|
58 |
+
}
|
59 |
+
if (isset($subject)) {
|
60 |
+
$this->setSubject($subject);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Add the email address to a EmailAddress object
|
66 |
+
*
|
67 |
+
* @param string $emailAddress The email address
|
68 |
+
*
|
69 |
+
* @throws TypeException
|
70 |
+
*/
|
71 |
+
public function setEmailAddress($emailAddress)
|
72 |
+
{
|
73 |
+
if (!(is_string($emailAddress) &&
|
74 |
+
filter_var($emailAddress, FILTER_VALIDATE_EMAIL))
|
75 |
+
) {
|
76 |
+
throw new TypeException(
|
77 |
+
'$emailAddress must be valid and of type string.'
|
78 |
+
);
|
79 |
+
}
|
80 |
+
$this->email = $emailAddress;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Retrieve the email address from a EmailAddress object
|
85 |
+
*
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function getEmailAddress()
|
89 |
+
{
|
90 |
+
return $this->email;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Retrieve the email address from a EmailAddress object
|
95 |
+
*
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
public function getEmail()
|
99 |
+
{
|
100 |
+
return $this->getEmailAddress();
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Add a name to a EmailAddress object
|
105 |
+
*
|
106 |
+
* @param string $name The name of the person associated with the email
|
107 |
+
*
|
108 |
+
* @throws TypeException
|
109 |
+
*/
|
110 |
+
public function setName($name)
|
111 |
+
{
|
112 |
+
if (!is_string($name)) {
|
113 |
+
throw new TypeException('$name must be of type string.');
|
114 |
+
}
|
115 |
+
|
116 |
+
/*
|
117 |
+
Issue #368
|
118 |
+
==========
|
119 |
+
If the name is not wrapped in double quotes and contains a comma or
|
120 |
+
semicolon, the API fails to parse it correctly.
|
121 |
+
When wrapped in double quotes, commas, semicolons and unescaped single
|
122 |
+
quotes are supported.
|
123 |
+
Escaped double quotes are supported as well but will appear unescaped in
|
124 |
+
the mail (e.g. "O\'Keefe").
|
125 |
+
Double quotes will be shown in some email clients, so the name should
|
126 |
+
only be wrapped when necessary.
|
127 |
+
*/
|
128 |
+
// Only wrapp in double quote if comma or semicolon are found
|
129 |
+
if (false !== strpos($name, ',') || false !== strpos($name, ';')) {
|
130 |
+
// Unescape quotes
|
131 |
+
$name = stripslashes(html_entity_decode($name, ENT_QUOTES));
|
132 |
+
// Escape only double quotes
|
133 |
+
$name = str_replace('"', '\\"', $name);
|
134 |
+
// Wrapp in double quotes
|
135 |
+
$name = '"' . $name . '"';
|
136 |
+
}
|
137 |
+
$this->name = (!empty($name)) ? $name : null;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Retrieve the name from a EmailAddress object
|
142 |
+
*
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
public function getName()
|
146 |
+
{
|
147 |
+
return $this->name;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Add substitutions to a EmailAddress object
|
152 |
+
*
|
153 |
+
* @param array $substitutions An array of key/value substitutions to
|
154 |
+
* be be applied to the text and html content
|
155 |
+
* of the email body
|
156 |
+
*
|
157 |
+
* @throws TypeException
|
158 |
+
*/
|
159 |
+
public function setSubstitutions($substitutions)
|
160 |
+
{
|
161 |
+
if (!is_array($substitutions)) {
|
162 |
+
throw new TypeException('$substitutions must be an array.');
|
163 |
+
}
|
164 |
+
|
165 |
+
$this->substitutions = $substitutions;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Retrieve substitutions from a EmailAddress object
|
170 |
+
*/
|
171 |
+
public function getSubstitutions()
|
172 |
+
{
|
173 |
+
return $this->substitutions;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Add a subject to a EmailAddress object
|
178 |
+
*
|
179 |
+
* @param string $subject The personalized subject of the email
|
180 |
+
*
|
181 |
+
* @throws TypeException
|
182 |
+
*/
|
183 |
+
public function setSubject($subject)
|
184 |
+
{
|
185 |
+
if (!is_string($subject)) {
|
186 |
+
throw new TypeException('$subject must be of type string.');
|
187 |
+
}
|
188 |
+
if (!($subject instanceof Subject)) {
|
189 |
+
$this->subject = new Subject($subject);
|
190 |
+
} else {
|
191 |
+
$this->subject = $subject;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Retrieve a subject from a EmailAddress object
|
197 |
+
*
|
198 |
+
* @return Subject
|
199 |
+
*/
|
200 |
+
public function getSubject()
|
201 |
+
{
|
202 |
+
return $this->subject;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Return an array representing a EmailAddress object for the Twilio SendGrid API
|
207 |
+
*
|
208 |
+
* @return null|array
|
209 |
+
*/
|
210 |
+
public function jsonSerialize()
|
211 |
+
{
|
212 |
+
return array_filter(
|
213 |
+
[
|
214 |
+
'name' => $this->getName(),
|
215 |
+
'email' => $this->getEmail()
|
216 |
+
],
|
217 |
+
function ($value) {
|
218 |
+
return $value !== null;
|
219 |
+
}
|
220 |
+
) ?: null;
|
221 |
+
}
|
222 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Footer.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Footer object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Footer object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Footer implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
25 |
+
private $enable;
|
26 |
+
/** @var $text string The plain text content of your footer */
|
27 |
+
private $text;
|
28 |
+
/** @var $html string The HTML content of your footer */
|
29 |
+
private $html;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Optional constructor
|
33 |
+
*
|
34 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
35 |
+
* @param string|null $text The plain text content of your footer
|
36 |
+
* @param string|null $html The HTML content of your footer
|
37 |
+
*/
|
38 |
+
public function __construct($enable = null, $text = null, $html = null)
|
39 |
+
{
|
40 |
+
if (isset($enable)) {
|
41 |
+
$this->setEnable($enable);
|
42 |
+
}
|
43 |
+
if (isset($text)) {
|
44 |
+
$this->setText($text);
|
45 |
+
}
|
46 |
+
if (isset($html)) {
|
47 |
+
$this->setHtml($html);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Update the enable setting on a Footer object
|
53 |
+
*
|
54 |
+
* @param bool $enable Indicates if this setting is enabled
|
55 |
+
*
|
56 |
+
* @throws TypeException
|
57 |
+
*/
|
58 |
+
public function setEnable($enable)
|
59 |
+
{
|
60 |
+
if (!is_bool($enable)) {
|
61 |
+
throw new TypeException('$enable must be of type bool');
|
62 |
+
}
|
63 |
+
$this->enable = $enable;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Retrieve the enable setting on a Footer object
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function getEnable()
|
72 |
+
{
|
73 |
+
return $this->enable;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Add text to a Footer object
|
78 |
+
*
|
79 |
+
* @param string $text The plain text content of your footer
|
80 |
+
*
|
81 |
+
* @throws TypeException
|
82 |
+
*/
|
83 |
+
public function setText($text)
|
84 |
+
{
|
85 |
+
if (!is_string($text)) {
|
86 |
+
throw new TypeException('$text must be of type string.');
|
87 |
+
}
|
88 |
+
$this->text = $text;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Retrieve text to a Footer object
|
93 |
+
*
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function getText()
|
97 |
+
{
|
98 |
+
return $this->text;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Add html to a Footer object
|
103 |
+
*
|
104 |
+
* @param string $html The HTML content of your footer
|
105 |
+
*
|
106 |
+
* @throws TypeException
|
107 |
+
*/
|
108 |
+
public function setHtml($html)
|
109 |
+
{
|
110 |
+
if (!is_string($html)) {
|
111 |
+
throw new TypeException('$html must be of type string.');
|
112 |
+
}
|
113 |
+
$this->html = $html;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Retrieve html from a Footer object
|
118 |
+
*
|
119 |
+
* @return string
|
120 |
+
*/
|
121 |
+
public function getHtml()
|
122 |
+
{
|
123 |
+
return $this->html;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Return an array representing a Footer object for the Twilio SendGrid API
|
128 |
+
*
|
129 |
+
* @return null|array
|
130 |
+
*/
|
131 |
+
public function jsonSerialize()
|
132 |
+
{
|
133 |
+
return array_filter(
|
134 |
+
[
|
135 |
+
'enable' => $this->getEnable(),
|
136 |
+
'text' => $this->getText(),
|
137 |
+
'html' => $this->getHtml()
|
138 |
+
],
|
139 |
+
function ($value) {
|
140 |
+
return $value !== null;
|
141 |
+
}
|
142 |
+
) ?: null;
|
143 |
+
}
|
144 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/From.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the From object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a From object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class From extends EmailAddress implements \JsonSerializable
|
23 |
+
{
|
24 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Ganalytics.php
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Ganalytics object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Ganalytics object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Ganalytics implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
25 |
+
private $enable;
|
26 |
+
/** @var $utm_source string Name of the referrer source. (e.g. Google, SomeDomain.com, or Marketing Email) */
|
27 |
+
private $utm_source;
|
28 |
+
/** @var $utm_medium string Name of the marketing medium. (e.g. Email) */
|
29 |
+
private $utm_medium;
|
30 |
+
/** @var $utm_term string Used to identify any paid keywords */
|
31 |
+
private $utm_term;
|
32 |
+
/** @var $utm_content string Used to differentiate your campaign from advertisements */
|
33 |
+
private $utm_content;
|
34 |
+
/** @var $utm_campaign string The name of the campaign */
|
35 |
+
private $utm_campaign;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Optional constructor
|
39 |
+
*
|
40 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
41 |
+
* @param string|null $utm_source Name of the referrer source. (e.g.
|
42 |
+
* Google, SomeDomain.com, or Marketing Email)
|
43 |
+
* @param string|null $utm_medium Name of the marketing medium. (e.g. Email)
|
44 |
+
* @param string|null $utm_term Used to identify any paid keywords
|
45 |
+
* @param string|null $utm_content Used to differentiate your campaign from
|
46 |
+
* advertisements
|
47 |
+
* @param string|null $utm_campaign The name of the campaign
|
48 |
+
*/
|
49 |
+
public function __construct(
|
50 |
+
$enable = null,
|
51 |
+
$utm_source = null,
|
52 |
+
$utm_medium = null,
|
53 |
+
$utm_term = null,
|
54 |
+
$utm_content = null,
|
55 |
+
$utm_campaign = null
|
56 |
+
)
|
57 |
+
{
|
58 |
+
if (isset($enable)) {
|
59 |
+
$this->setEnable($enable);
|
60 |
+
}
|
61 |
+
if (isset($utm_source)) {
|
62 |
+
$this->setCampaignSource($utm_source);
|
63 |
+
}
|
64 |
+
if (isset($utm_medium)) {
|
65 |
+
$this->setCampaignMedium($utm_medium);
|
66 |
+
}
|
67 |
+
if (isset($utm_term)) {
|
68 |
+
$this->setCampaignTerm($utm_term);
|
69 |
+
}
|
70 |
+
if (isset($utm_content)) {
|
71 |
+
$this->setCampaignContent($utm_content);
|
72 |
+
}
|
73 |
+
if (isset($utm_campaign)) {
|
74 |
+
$this->setCampaignName($utm_campaign);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Update the enable setting on a Ganalytics object
|
80 |
+
*
|
81 |
+
* @param bool $enable Indicates if this setting is enabled
|
82 |
+
*
|
83 |
+
* @throws TypeException
|
84 |
+
*/
|
85 |
+
public function setEnable($enable)
|
86 |
+
{
|
87 |
+
if (!is_bool($enable)) {
|
88 |
+
throw new TypeException('$enable must be of type bool.');
|
89 |
+
}
|
90 |
+
$this->enable = $enable;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Retrieve the enable setting on a Ganalytics object
|
95 |
+
*
|
96 |
+
* @return bool
|
97 |
+
*/
|
98 |
+
public function getEnable()
|
99 |
+
{
|
100 |
+
return $this->enable;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Add the campaign source to a Ganalytics object
|
105 |
+
*
|
106 |
+
* @param string $utm_source Name of the referrer source. (e.g.
|
107 |
+
* Google, SomeDomain.com, or Marketing Email)
|
108 |
+
*
|
109 |
+
* @throws TypeException
|
110 |
+
*/
|
111 |
+
public function setCampaignSource($utm_source)
|
112 |
+
{
|
113 |
+
if (!is_string($utm_source)) {
|
114 |
+
throw new TypeException('$utm_source must be of type string.');
|
115 |
+
}
|
116 |
+
$this->utm_source = $utm_source;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Return the campaign source from a Ganalytics object
|
121 |
+
*
|
122 |
+
* @return string
|
123 |
+
*/
|
124 |
+
public function getCampaignSource()
|
125 |
+
{
|
126 |
+
return $this->utm_source;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Add the campaign medium to a Ganalytics object
|
131 |
+
*
|
132 |
+
* @param string $utm_medium Name of the marketing medium. (e.g. Email)
|
133 |
+
*
|
134 |
+
* @throws TypeException
|
135 |
+
*/
|
136 |
+
public function setCampaignMedium($utm_medium)
|
137 |
+
{
|
138 |
+
if (!is_string($utm_medium)) {
|
139 |
+
throw new TypeException('$utm_medium must be of type string.');
|
140 |
+
}
|
141 |
+
$this->utm_medium = $utm_medium;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Return the campaign medium from a Ganalytics object
|
146 |
+
*
|
147 |
+
* @return string
|
148 |
+
*/
|
149 |
+
public function getCampaignMedium()
|
150 |
+
{
|
151 |
+
return $this->utm_medium;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Add the campaign term to a Ganalytics object
|
156 |
+
*
|
157 |
+
* @param string $utm_term Used to identify any paid keywords
|
158 |
+
*
|
159 |
+
* @throws TypeException
|
160 |
+
*/
|
161 |
+
public function setCampaignTerm($utm_term)
|
162 |
+
{
|
163 |
+
if (!is_string($utm_term)) {
|
164 |
+
throw new TypeException('$utm_term must be of type string');
|
165 |
+
}
|
166 |
+
$this->utm_term = $utm_term;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Return the campaign term from a Ganalytics object
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function getCampaignTerm()
|
175 |
+
{
|
176 |
+
return $this->utm_term;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Add the campaign content to a Ganalytics object
|
181 |
+
*
|
182 |
+
* @param string $utm_content Used to differentiate your campaign from
|
183 |
+
* advertisements
|
184 |
+
*
|
185 |
+
* @throws TypeException
|
186 |
+
*/
|
187 |
+
public function setCampaignContent($utm_content)
|
188 |
+
{
|
189 |
+
if (!is_string($utm_content)) {
|
190 |
+
throw new TypeException('$utm_content must be of type string.');
|
191 |
+
}
|
192 |
+
$this->utm_content = $utm_content;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Return the campaign content from a Ganalytics object
|
197 |
+
*
|
198 |
+
* @return string
|
199 |
+
*/
|
200 |
+
public function getCampaignContent()
|
201 |
+
{
|
202 |
+
return $this->utm_content;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Add the campaign name to a Ganalytics object
|
207 |
+
*
|
208 |
+
* @param string $utm_campaign The name of the campaign
|
209 |
+
*
|
210 |
+
* @throws TypeException
|
211 |
+
*/
|
212 |
+
public function setCampaignName($utm_campaign)
|
213 |
+
{
|
214 |
+
if (!is_string($utm_campaign)) {
|
215 |
+
throw new TypeException('$utm_campaign must be of type string.');
|
216 |
+
}
|
217 |
+
$this->utm_campaign = $utm_campaign;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Return the campaign name from a Ganalytics object
|
222 |
+
*
|
223 |
+
* @return string
|
224 |
+
*/
|
225 |
+
public function getCampaignName()
|
226 |
+
{
|
227 |
+
return $this->utm_campaign;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Return an array representing a Ganalytics object for the Twilio SendGrid API
|
232 |
+
*
|
233 |
+
* @return null|array
|
234 |
+
*/
|
235 |
+
public function jsonSerialize()
|
236 |
+
{
|
237 |
+
return array_filter(
|
238 |
+
[
|
239 |
+
'enable' => $this->getEnable(),
|
240 |
+
'utm_source' => $this->getCampaignSource(),
|
241 |
+
'utm_medium' => $this->getCampaignMedium(),
|
242 |
+
'utm_term' => $this->getCampaignTerm(),
|
243 |
+
'utm_content' => $this->getCampaignContent(),
|
244 |
+
'utm_campaign' => $this->getCampaignName()
|
245 |
+
],
|
246 |
+
function ($value) {
|
247 |
+
return $value !== null;
|
248 |
+
}
|
249 |
+
) ?: null;
|
250 |
+
}
|
251 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/GroupId.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the GroupId object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a GroupId object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class GroupId implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $group_id int The unsubscribe group to associate with this email */
|
25 |
+
private $group_id;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Optional constructor
|
29 |
+
*
|
30 |
+
* @param int|null $group_id The unsubscribe group to associate with this email
|
31 |
+
*/
|
32 |
+
public function __construct($group_id = null)
|
33 |
+
{
|
34 |
+
if (isset($group_id)) {
|
35 |
+
$this->setGroupId($group_id);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Add the group id to a GroupId object
|
41 |
+
*
|
42 |
+
* @param int $group_id The unsubscribe group to associate with this email
|
43 |
+
*
|
44 |
+
* @throws TypeException
|
45 |
+
*/
|
46 |
+
public function setGroupId($group_id)
|
47 |
+
{
|
48 |
+
if (!is_int($group_id)) {
|
49 |
+
throw new TypeException('$group_id must be of type int.');
|
50 |
+
}
|
51 |
+
$this->group_id = $group_id;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve the group id from a GroupId object
|
56 |
+
*
|
57 |
+
* @return int
|
58 |
+
*/
|
59 |
+
public function getGroupId()
|
60 |
+
{
|
61 |
+
return $this->group_id;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Return an array representing a GroupId object for the Twilio SendGrid API
|
66 |
+
*
|
67 |
+
* @return int
|
68 |
+
*/
|
69 |
+
public function jsonSerialize()
|
70 |
+
{
|
71 |
+
return $this->getGroupId();
|
72 |
+
}
|
73 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/GroupsToDisplay.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the GroupsToDisplay object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a GroupsToDisplay object for
|
19 |
+
* the /mail/send API call
|
20 |
+
*
|
21 |
+
* @package SendGrid\Mail
|
22 |
+
*/
|
23 |
+
class GroupsToDisplay implements \JsonSerializable
|
24 |
+
{
|
25 |
+
/** @var $groups_to_display int[] An array containing the unsubscribe groups that you would like to be displayed on the unsubscribe preferences page. Maximum of 25 */
|
26 |
+
private $groups_to_display;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Optional constructor
|
30 |
+
*
|
31 |
+
* @param int[]|int|null $groups_to_display An array containing
|
32 |
+
* the unsubscribe groups
|
33 |
+
* that you would like to
|
34 |
+
* be displayed on the
|
35 |
+
* unsubscribe preferences
|
36 |
+
* page. Maximum of 25
|
37 |
+
*/
|
38 |
+
public function __construct($groups_to_display = null)
|
39 |
+
{
|
40 |
+
if (isset($groups_to_display)) {
|
41 |
+
$this->setGroupsToDisplay($groups_to_display);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Add a group to display on a GroupsToDisplay object
|
47 |
+
*
|
48 |
+
* @param int|int[] $groups_to_display The unsubscribe group(s)
|
49 |
+
* that you would like to be
|
50 |
+
* displayed on the unsubscribe
|
51 |
+
* preferences page
|
52 |
+
*
|
53 |
+
* @throws TypeException
|
54 |
+
* @return null
|
55 |
+
*/
|
56 |
+
public function setGroupsToDisplay($groups_to_display)
|
57 |
+
{
|
58 |
+
if (!is_array($groups_to_display)) {
|
59 |
+
throw new TypeException('$groups_to_display must be an array.');
|
60 |
+
}
|
61 |
+
if (is_array($groups_to_display)) {
|
62 |
+
$this->groups_to_display = $groups_to_display;
|
63 |
+
} else {
|
64 |
+
$this->groups_to_display[] = $groups_to_display;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Return the group(s) to display on a GroupsToDisplay object
|
70 |
+
*
|
71 |
+
* @return int[]
|
72 |
+
*/
|
73 |
+
public function getGroupsToDisplay()
|
74 |
+
{
|
75 |
+
return $this->groups_to_display;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Return an array representing a GroupsToDisplay object for the Twilio SendGrid API
|
80 |
+
*
|
81 |
+
* @return null|array
|
82 |
+
*/
|
83 |
+
public function jsonSerialize()
|
84 |
+
{
|
85 |
+
return $this->getGroupsToDisplay();
|
86 |
+
}
|
87 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Header.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Header object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Header object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* An object containing key/value pairs of header names and the value to substitute
|
21 |
+
* for them. You must ensure these are properly encoded if they contain unicode
|
22 |
+
* characters. Must not be one of the reserved headers
|
23 |
+
*
|
24 |
+
* @package SendGrid\Mail
|
25 |
+
*/
|
26 |
+
class Header implements \JsonSerializable
|
27 |
+
{
|
28 |
+
/** @var $key string Header key */
|
29 |
+
private $key;
|
30 |
+
/** @var $value string Header value */
|
31 |
+
private $value;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Optional constructor
|
35 |
+
*
|
36 |
+
* @param string|null $key Header key
|
37 |
+
* @param string|null $value Header value
|
38 |
+
*/
|
39 |
+
public function __construct($key = null, $value = null)
|
40 |
+
{
|
41 |
+
if (isset($key)) {
|
42 |
+
$this->setKey($key);
|
43 |
+
}
|
44 |
+
if (isset($value)) {
|
45 |
+
$this->setValue($value);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Add the key on a Header object
|
51 |
+
*
|
52 |
+
* @param string $key Header key
|
53 |
+
*
|
54 |
+
* @throws TypeException
|
55 |
+
*/
|
56 |
+
public function setKey($key)
|
57 |
+
{
|
58 |
+
if (!is_string($key)) {
|
59 |
+
throw new TypeException('$key must be of type string.');
|
60 |
+
}
|
61 |
+
$this->key = $key;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Retrieve the key from a Header object
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getKey()
|
70 |
+
{
|
71 |
+
return $this->key;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Add the value on a Header object
|
76 |
+
*
|
77 |
+
* @param string $value Header value
|
78 |
+
*
|
79 |
+
* @throws TypeException
|
80 |
+
*/
|
81 |
+
public function setValue($value)
|
82 |
+
{
|
83 |
+
if (!is_string($value)) {
|
84 |
+
throw new TypeException('$value must be of type string.');
|
85 |
+
}
|
86 |
+
$this->value = $value;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retrieve the value from a Header object
|
91 |
+
*
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
public function getValue()
|
95 |
+
{
|
96 |
+
return $this->value;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Return an array representing a Header object for the Twilio SendGrid API
|
101 |
+
*
|
102 |
+
* @return null|array
|
103 |
+
*/
|
104 |
+
public function jsonSerialize()
|
105 |
+
{
|
106 |
+
return array_filter(
|
107 |
+
[
|
108 |
+
'key' => $this->getKey(),
|
109 |
+
'value' => $this->getValue()
|
110 |
+
],
|
111 |
+
function ($value) {
|
112 |
+
return $value !== null;
|
113 |
+
}
|
114 |
+
) ?: null;
|
115 |
+
}
|
116 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/HtmlContent.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Content object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Content object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class HtmlContent extends Content
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Create a Content object with a HTML mime type
|
26 |
+
*
|
27 |
+
* @param string $value HTML formatted content
|
28 |
+
*/
|
29 |
+
public function __construct($value)
|
30 |
+
{
|
31 |
+
parent::__construct(MimeType::HTML, $value);
|
32 |
+
}
|
33 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/IpPoolName.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the IpPoolName object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a IpPoolName object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class IpPoolName implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $ip_pool_name string The IP Pool that you would like to send this email from. Minimum length: 2, Maximum Length: 64 */
|
25 |
+
private $ip_pool_name;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Optional constructor
|
29 |
+
*
|
30 |
+
* @param string|null $ip_pool_name The IP Pool that you would like to
|
31 |
+
* send this email from. Minimum length:
|
32 |
+
* 2, Maximum Length: 64
|
33 |
+
*/
|
34 |
+
public function __construct($ip_pool_name = null)
|
35 |
+
{
|
36 |
+
if (isset($ip_pool_name)) {
|
37 |
+
$this->setIpPoolName($ip_pool_name);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Set the ip pool name on a IpPoolName object
|
43 |
+
*
|
44 |
+
* @param string $ip_pool_name The IP Pool that you would like to
|
45 |
+
* send this email from. Minimum length:
|
46 |
+
* 2, Maximum Length: 64
|
47 |
+
*
|
48 |
+
* @throws TypeException
|
49 |
+
*/
|
50 |
+
public function setIpPoolName($ip_pool_name)
|
51 |
+
{
|
52 |
+
if (!is_string($ip_pool_name)) {
|
53 |
+
throw new TypeException('$ip_pool_name must be of type string.');
|
54 |
+
}
|
55 |
+
$this->ip_pool_name = $ip_pool_name;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Retrieve the ip pool name from a IpPoolName object
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getIpPoolName()
|
64 |
+
{
|
65 |
+
return $this->ip_pool_name;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Return an array representing a IpPoolName object for the Twilio SendGrid API
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function jsonSerialize()
|
74 |
+
{
|
75 |
+
return $this->getIpPoolName();
|
76 |
+
}
|
77 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Mail.php
ADDED
@@ -0,0 +1,1911 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the request body for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a request body for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Mail implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $from From Email address of the sender */
|
25 |
+
private $from;
|
26 |
+
|
27 |
+
/** @var $subject Subject Subject of the email */
|
28 |
+
private $subject;
|
29 |
+
|
30 |
+
/** @var $contents Content[] Content(s) of the email */
|
31 |
+
private $contents;
|
32 |
+
|
33 |
+
/** @var $attachments Attachment[] Email attachments */
|
34 |
+
private $attachments;
|
35 |
+
|
36 |
+
/** @var $template_id TemplateId Id of a template that you would like to use */
|
37 |
+
private $template_id;
|
38 |
+
|
39 |
+
/** @var $sections Section[] Key/value pairs that define block sections of code to be used as substitutions */
|
40 |
+
private $sections;
|
41 |
+
|
42 |
+
/** @var $headers Header[] Header names and the value to substitute for them */
|
43 |
+
private $headers;
|
44 |
+
|
45 |
+
/** @var $categories Category[] Category names for this message */
|
46 |
+
private $categories;
|
47 |
+
|
48 |
+
/** @var $custom_args CustomArg[] Values that are specific to the entire send that will be carried along with the email and its activity data */
|
49 |
+
private $custom_args;
|
50 |
+
|
51 |
+
/** @var $substitutions Substitution[] Substitutions that will apply to the text and html content of the body of your email, in addition to the subject and reply-to parameters */
|
52 |
+
private $substitutions;
|
53 |
+
|
54 |
+
/** @var $send_at SendAt A unix timestamp allowing you to specify when you want your email to be delivered */
|
55 |
+
private $send_at;
|
56 |
+
|
57 |
+
/** @var $batch_id BatchId This ID represents a batch of emails to be sent at the same time */
|
58 |
+
private $batch_id;
|
59 |
+
|
60 |
+
/** @var $asm ASM Specifies how to handle unsubscribes */
|
61 |
+
private $asm;
|
62 |
+
|
63 |
+
/** @var $ip_pool_name IpPoolName The IP Pool that you would like to send this email from */
|
64 |
+
private $ip_pool_name;
|
65 |
+
|
66 |
+
/** @var $mail_settings MailSettings A collection of different mail settings that you can use to specify how you would like this email to be handled */
|
67 |
+
private $mail_settings;
|
68 |
+
|
69 |
+
/** @var $tracking_settings TrackingSettings Settings to determine how you would like to track the metrics of how your recipients interact with your email */
|
70 |
+
private $tracking_settings;
|
71 |
+
|
72 |
+
/** @var $reply_to ReplyTo Email to be use when replied to */
|
73 |
+
private $reply_to;
|
74 |
+
|
75 |
+
/** @var $personalization Personalization[] Messages and their metadata */
|
76 |
+
private $personalization;
|
77 |
+
|
78 |
+
const VERSION = "7.0.0";
|
79 |
+
|
80 |
+
/**
|
81 |
+
* If passing parameters into this constructor include
|
82 |
+
* $from, $to, $subject, $plainTextContent and
|
83 |
+
* $htmlContent at a minimum. In that case, a Personalization
|
84 |
+
* object will be created for you.
|
85 |
+
*
|
86 |
+
* @param From|null $from Email address of the sender
|
87 |
+
* @param To|To[]|null $to Recipient(s) email
|
88 |
+
* address(es)
|
89 |
+
* @param Subject|Subject[]|null $subject Subject(s)
|
90 |
+
* @param PlainTextContent|null $plainTextContent Plain text version of
|
91 |
+
* content
|
92 |
+
* @param HtmlContent|null $htmlContent Html version of content
|
93 |
+
* @param Substitution[]|null $globalSubstitutions Substitutions for entire
|
94 |
+
* email
|
95 |
+
*/
|
96 |
+
public function __construct(
|
97 |
+
$from = null,
|
98 |
+
$to = null,
|
99 |
+
$subject = null,
|
100 |
+
$plainTextContent = null,
|
101 |
+
$htmlContent = null,
|
102 |
+
array $globalSubstitutions = null
|
103 |
+
) {
|
104 |
+
if (!isset($from)
|
105 |
+
&& !isset($to)
|
106 |
+
&& !isset($subject)
|
107 |
+
&& !isset($plainTextContent)
|
108 |
+
&& !isset($htmlContent)
|
109 |
+
&& !isset($globalSubstitutions)
|
110 |
+
) {
|
111 |
+
$this->personalization[] = new Personalization();
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
if (isset($from)) {
|
115 |
+
$this->setFrom($from);
|
116 |
+
}
|
117 |
+
if (isset($to)) {
|
118 |
+
if (!is_array($to)) {
|
119 |
+
$to = [$to];
|
120 |
+
}
|
121 |
+
$subjectCount = 0;
|
122 |
+
$personalization = new Personalization();
|
123 |
+
foreach ($to as $email) {
|
124 |
+
if ($subs = $email->getSubstitutions()) {
|
125 |
+
$personalization = new Personalization();
|
126 |
+
}
|
127 |
+
$personalization->addTo($email);
|
128 |
+
if ($subs = $email->getSubstitutions()) {
|
129 |
+
foreach ($subs as $key => $value) {
|
130 |
+
$personalization->addSubstitution($key, $value);
|
131 |
+
}
|
132 |
+
}
|
133 |
+
if ($email->getSubject()) {
|
134 |
+
$personalization->setSubject($email->getSubject());
|
135 |
+
}
|
136 |
+
if (is_array($subject)) {
|
137 |
+
if ($subjectCount < sizeof($subject)) {
|
138 |
+
$personalization->setSubject($subject[$subjectCount]);
|
139 |
+
}
|
140 |
+
$subjectCount++;
|
141 |
+
}
|
142 |
+
if (is_array($globalSubstitutions)) {
|
143 |
+
foreach ($globalSubstitutions as $key => $value) {
|
144 |
+
$personalization->addSubstitution($key, $value);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
if ($subs = $email->getSubstitutions()) {
|
148 |
+
$this->addPersonalization($personalization);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if (!$subs = $email->getSubstitutions()) {
|
152 |
+
$this->addPersonalization($personalization);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
if (isset($subject)) {
|
156 |
+
if (!is_array($subject)) {
|
157 |
+
$this->setSubject($subject);
|
158 |
+
}
|
159 |
+
}
|
160 |
+
if (isset($plainTextContent)) {
|
161 |
+
$this->addContent($plainTextContent);
|
162 |
+
}
|
163 |
+
if (isset($htmlContent)) {
|
164 |
+
$this->addContent($htmlContent);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Adds a To, Cc or Bcc object to a Personalization object
|
170 |
+
*
|
171 |
+
* @param string $emailType Object type name:
|
172 |
+
* To, Cc or Bcc
|
173 |
+
* @param string $email Recipient email
|
174 |
+
* address
|
175 |
+
* @param string|null $name Recipient name
|
176 |
+
* @param Substitution[]|array|null $substitutions Personalized
|
177 |
+
* substitutions
|
178 |
+
* @param int|null $personalizationIndex Index into an array
|
179 |
+
* of existing
|
180 |
+
* Personalization
|
181 |
+
* objects
|
182 |
+
* @param Personalization|null $personalization A pre-created
|
183 |
+
* Personalization object
|
184 |
+
*
|
185 |
+
* @return null
|
186 |
+
*/
|
187 |
+
private function addRecipientEmail(
|
188 |
+
$emailType,
|
189 |
+
$email,
|
190 |
+
$name = null,
|
191 |
+
$substitutions = null,
|
192 |
+
$personalizationIndex = null,
|
193 |
+
$personalization = null
|
194 |
+
) {
|
195 |
+
$personalizationFunctionCall = "add" . $emailType;
|
196 |
+
$emailType = "\SendGrid\Mail\\" . $emailType;
|
197 |
+
if (!($email instanceof $emailType)) {
|
198 |
+
$email = new $emailType(
|
199 |
+
$email,
|
200 |
+
$name,
|
201 |
+
$substitutions
|
202 |
+
);
|
203 |
+
}
|
204 |
+
if ($personalization != null) {
|
205 |
+
$personalization->$personalizationFunctionCall($email);
|
206 |
+
if ($subs = $email->getSubstitutions()) {
|
207 |
+
foreach ($subs as $key => $value) {
|
208 |
+
$personalization->addSubstitution($key, $value);
|
209 |
+
}
|
210 |
+
}
|
211 |
+
$this->addPersonalization($personalization);
|
212 |
+
return;
|
213 |
+
} else {
|
214 |
+
if (isset($personalizationIndex)
|
215 |
+
&& !isset($this->personalization[$personalizationIndex])
|
216 |
+
) {
|
217 |
+
// TODO: We should only do this if there exists an index
|
218 |
+
// previous. For example, if given an index 3 and there is
|
219 |
+
// no index 2, we should throw an error.
|
220 |
+
$this->personalization[$personalizationIndex]
|
221 |
+
= new Personalization();
|
222 |
+
}
|
223 |
+
if ($this->personalization[0] != null && $personalizationIndex == 0) {
|
224 |
+
$this->personalization[0]->$personalizationFunctionCall($email);
|
225 |
+
if ($subs = $email->getSubstitutions()) {
|
226 |
+
foreach ($subs as $key => $value) {
|
227 |
+
$this->personalization[0]->addSubstitution($key, $value);
|
228 |
+
}
|
229 |
+
}
|
230 |
+
return;
|
231 |
+
} else if ($this->personalization[$personalizationIndex] != null) {
|
232 |
+
$this->personalization[$personalizationIndex]->$personalizationFunctionCall($email);
|
233 |
+
if ($subs = $email->getSubstitutions()) {
|
234 |
+
foreach ($subs as $key => $value) {
|
235 |
+
$this->personalization[$personalizationIndex]->addSubstitution(
|
236 |
+
$key,
|
237 |
+
$value
|
238 |
+
);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
return;
|
242 |
+
} else {
|
243 |
+
$personalization = new Personalization();
|
244 |
+
$personalization->$personalizationFunctionCall($email);
|
245 |
+
if ($subs = $email->getSubstitutions()) {
|
246 |
+
foreach ($subs as $key => $value) {
|
247 |
+
$personalization->addSubstitution($key, $value);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
if (($personalizationIndex != 0)
|
251 |
+
&& ($this->getPersonalizationCount() <= $personalizationIndex)
|
252 |
+
) {
|
253 |
+
$this->personalization[$personalizationIndex] = $personalization;
|
254 |
+
} else {
|
255 |
+
$this->addPersonalization($personalization);
|
256 |
+
}
|
257 |
+
return;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Adds an array of To, Cc or Bcc objects to a Personalization object
|
264 |
+
*
|
265 |
+
* @param string $emailType Object type name: To, Cc
|
266 |
+
* or Bcc
|
267 |
+
* @param To[]|Cc[]|Bcc[] $emails Array of email recipients
|
268 |
+
* @param int|null $personalizationIndex Index into an array of
|
269 |
+
* existing Personalization
|
270 |
+
* objects
|
271 |
+
* @param Personalization|null $personalization A Personalization object
|
272 |
+
*/
|
273 |
+
private function addRecipientEmails(
|
274 |
+
$emailType,
|
275 |
+
$emails,
|
276 |
+
$personalizationIndex = null,
|
277 |
+
$personalization = null
|
278 |
+
) {
|
279 |
+
$emailFunctionCall = "add" . $emailType;
|
280 |
+
|
281 |
+
if (current($emails) instanceof EmailAddress) {
|
282 |
+
foreach ($emails as $email) {
|
283 |
+
$this->$emailFunctionCall(
|
284 |
+
$email,
|
285 |
+
$name = null,
|
286 |
+
$personalizationIndex,
|
287 |
+
$personalization
|
288 |
+
);
|
289 |
+
}
|
290 |
+
} else {
|
291 |
+
foreach ($emails as $email => $name) {
|
292 |
+
$this->$emailFunctionCall(
|
293 |
+
$email,
|
294 |
+
$name,
|
295 |
+
$personalizationIndex,
|
296 |
+
$personalization
|
297 |
+
);
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Add a Personalization object to the Mail object
|
304 |
+
*
|
305 |
+
* @param Personalization $personalization A Personalization object
|
306 |
+
*/
|
307 |
+
public function addPersonalization($personalization)
|
308 |
+
{
|
309 |
+
$this->personalization[] = $personalization;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Retrieve a Personalization object from the Mail object
|
314 |
+
*
|
315 |
+
* @return Personalization[]
|
316 |
+
*/
|
317 |
+
public function getPersonalizations()
|
318 |
+
{
|
319 |
+
return $this->personalization;
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Retrieve the number of Personalization objects associated with the Mail object
|
324 |
+
*
|
325 |
+
* @return int
|
326 |
+
*/
|
327 |
+
public function getPersonalizationCount()
|
328 |
+
{
|
329 |
+
return count($this->personalization);
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Adds an email recipient to a Personalization object
|
334 |
+
*
|
335 |
+
* @param string|To $to Email address or To object
|
336 |
+
* @param string $name Recipient name
|
337 |
+
* @param array|Substitution[] $substitutions Personalized substitutions
|
338 |
+
* @param int|null $personalizationIndex Index into an array of
|
339 |
+
* existing Personalization
|
340 |
+
* objects
|
341 |
+
* @param Personalization|null $personalization A pre-created
|
342 |
+
* Personalization object
|
343 |
+
*/
|
344 |
+
public function addTo(
|
345 |
+
$to,
|
346 |
+
$name = null,
|
347 |
+
$substitutions = null,
|
348 |
+
$personalizationIndex = null,
|
349 |
+
$personalization = null
|
350 |
+
) {
|
351 |
+
if ($to instanceof To) {
|
352 |
+
$name = $to->getName();
|
353 |
+
$substitutions = $to->getSubstitutions();
|
354 |
+
$to = $to->getEmailAddress();
|
355 |
+
}
|
356 |
+
$this->addRecipientEmail(
|
357 |
+
"To",
|
358 |
+
$to,
|
359 |
+
$name,
|
360 |
+
$substitutions,
|
361 |
+
$personalizationIndex,
|
362 |
+
$personalization
|
363 |
+
);
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Adds multiple email recipients to a Personalization object
|
368 |
+
*
|
369 |
+
* @param To[]|array $toEmails Array of To objects or
|
370 |
+
* key/value pairs of email
|
371 |
+
* address/recipient names
|
372 |
+
* @param int|null $personalizationIndex Index into an array of
|
373 |
+
* existing Personalization
|
374 |
+
* objects
|
375 |
+
* @param Personalization|null $personalization A pre-created
|
376 |
+
* Personalization object
|
377 |
+
*/
|
378 |
+
public function addTos(
|
379 |
+
$toEmails,
|
380 |
+
$personalizationIndex = null,
|
381 |
+
$personalization = null
|
382 |
+
) {
|
383 |
+
$this->addRecipientEmails(
|
384 |
+
"To",
|
385 |
+
$toEmails,
|
386 |
+
$personalizationIndex,
|
387 |
+
$personalization
|
388 |
+
);
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Adds an email cc recipient to a Personalization object
|
393 |
+
*
|
394 |
+
* @param string|Cc $cc Email address or Cc object
|
395 |
+
* @param string $name Recipient name
|
396 |
+
* @param int|null $personalizationIndex Index into an array of
|
397 |
+
* existing Personalization
|
398 |
+
* objects
|
399 |
+
* @param Personalization|null $personalization A pre-created
|
400 |
+
* Personalization object
|
401 |
+
*/
|
402 |
+
public function addCc(
|
403 |
+
$cc,
|
404 |
+
$name = null,
|
405 |
+
$personalizationIndex = null,
|
406 |
+
$personalization = null
|
407 |
+
) {
|
408 |
+
if ($cc instanceof Cc) {
|
409 |
+
$name = $cc->getName();
|
410 |
+
$cc = $cc->getEmailAddress();
|
411 |
+
}
|
412 |
+
$this->addRecipientEmail(
|
413 |
+
"Cc",
|
414 |
+
$cc,
|
415 |
+
$name,
|
416 |
+
$personalizationIndex,
|
417 |
+
$personalization
|
418 |
+
);
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Adds multiple email cc recipients to a Personalization object
|
423 |
+
*
|
424 |
+
* @param Cc[]|array $ccEmails Array of Cc objects or
|
425 |
+
* key/value pairs of email
|
426 |
+
* address/recipient names
|
427 |
+
* @param int|null $personalizationIndex Index into an array of
|
428 |
+
* existing Personalization
|
429 |
+
* objects
|
430 |
+
* @param Personalization|null $personalization A pre-created
|
431 |
+
* Personalization object
|
432 |
+
*/
|
433 |
+
public function addCcs(
|
434 |
+
$ccEmails,
|
435 |
+
$personalizationIndex = null,
|
436 |
+
$personalization = null
|
437 |
+
) {
|
438 |
+
$this->addRecipientEmails(
|
439 |
+
"Cc",
|
440 |
+
$ccEmails,
|
441 |
+
$personalizationIndex,
|
442 |
+
$personalization
|
443 |
+
);
|
444 |
+
}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Adds an email bcc recipient to a Personalization object
|
448 |
+
*
|
449 |
+
* @param string|Bcc $bcc Email address or Bcc object
|
450 |
+
* @param string $name Recipient name
|
451 |
+
* @param int|null $personalizationIndex Index into an array of
|
452 |
+
* existing Personalization
|
453 |
+
* objects
|
454 |
+
* @param Personalization|null $personalization A pre-created
|
455 |
+
* Personalization object
|
456 |
+
*/
|
457 |
+
public function addBcc(
|
458 |
+
$bcc,
|
459 |
+
$name = null,
|
460 |
+
$personalizationIndex = null,
|
461 |
+
$personalization = null
|
462 |
+
) {
|
463 |
+
if ($bcc instanceof Bcc) {
|
464 |
+
$name = $bcc->getName();
|
465 |
+
$bcc = $bcc->getEmailAddress();
|
466 |
+
}
|
467 |
+
$this->addRecipientEmail(
|
468 |
+
"Bcc",
|
469 |
+
$bcc,
|
470 |
+
$name,
|
471 |
+
$personalizationIndex,
|
472 |
+
$personalization
|
473 |
+
);
|
474 |
+
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Adds multiple email bcc recipients to a Personalization object
|
478 |
+
*
|
479 |
+
* @param Bcc[]|array $bccEmails Array of Bcc objects or
|
480 |
+
* key/value pairs of email
|
481 |
+
* address/recipient names
|
482 |
+
* @param int|null $personalizationIndex Index into an array of
|
483 |
+
* existing Personalization
|
484 |
+
* objects
|
485 |
+
* @param Personalization|null $personalization A pre-created
|
486 |
+
* Personalization object
|
487 |
+
*/
|
488 |
+
public function addBccs(
|
489 |
+
$bccEmails,
|
490 |
+
$personalizationIndex = null,
|
491 |
+
$personalization = null
|
492 |
+
) {
|
493 |
+
$this->addRecipientEmails(
|
494 |
+
"Bcc",
|
495 |
+
$bccEmails,
|
496 |
+
$personalizationIndex,
|
497 |
+
$personalization
|
498 |
+
);
|
499 |
+
}
|
500 |
+
|
501 |
+
/**
|
502 |
+
* Add a subject to a Personalization or Mail object
|
503 |
+
*
|
504 |
+
* If you don't provide a Personalization object or index, the
|
505 |
+
* subject will be global to entire message. Note that
|
506 |
+
* subjects added to Personalization objects override
|
507 |
+
* global subjects.
|
508 |
+
*
|
509 |
+
* @param string|Subject $subject Email subject
|
510 |
+
* @param int|null $personalizationIndex Index into an array of
|
511 |
+
* existing Personalization
|
512 |
+
* objects
|
513 |
+
* @param Personalization|null $personalization A pre-created
|
514 |
+
* Personalization object
|
515 |
+
*/
|
516 |
+
public function setSubject(
|
517 |
+
$subject,
|
518 |
+
$personalizationIndex = null,
|
519 |
+
$personalization = null
|
520 |
+
) {
|
521 |
+
if (!($subject instanceof Subject)) {
|
522 |
+
$subject = new Subject($subject);
|
523 |
+
}
|
524 |
+
|
525 |
+
if ($personalization != null) {
|
526 |
+
$personalization->setSubject($subject);
|
527 |
+
$this->addPersonalization($personalization);
|
528 |
+
return;
|
529 |
+
}
|
530 |
+
if ($personalizationIndex != null) {
|
531 |
+
$this->personalization[$personalizationIndex]->setSubject($subject);
|
532 |
+
return;
|
533 |
+
}
|
534 |
+
$this->setGlobalSubject($subject);
|
535 |
+
return;
|
536 |
+
}
|
537 |
+
|
538 |
+
/**
|
539 |
+
* Retrieve a subject attached to a Personalization object
|
540 |
+
*
|
541 |
+
* @param int|0 $personalizationIndex Index into an array of
|
542 |
+
* existing Personalization
|
543 |
+
* objects
|
544 |
+
*
|
545 |
+
* @return Subject
|
546 |
+
*/
|
547 |
+
public function getSubject($personalizationIndex = 0)
|
548 |
+
{
|
549 |
+
return $this->personalization[$personalizationIndex]->getSubject();
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Add a header to a Personalization or Mail object
|
554 |
+
*
|
555 |
+
* If you don't provide a Personalization object or index, the
|
556 |
+
* header will be global to entire message. Note that
|
557 |
+
* headers added to Personalization objects override
|
558 |
+
* global headers.
|
559 |
+
*
|
560 |
+
* @param string|Header $key Key or Header object
|
561 |
+
* @param string|null $value Value
|
562 |
+
* @param int|null $personalizationIndex Index into an array of
|
563 |
+
* existing Personalization
|
564 |
+
* objects
|
565 |
+
* @param Personalization|null $personalization A pre-created
|
566 |
+
* Personalization object
|
567 |
+
*/
|
568 |
+
public function addHeader(
|
569 |
+
$key,
|
570 |
+
$value = null,
|
571 |
+
$personalizationIndex = null,
|
572 |
+
$personalization = null
|
573 |
+
) {
|
574 |
+
$header = null;
|
575 |
+
if ($key instanceof Header) {
|
576 |
+
$h = $key;
|
577 |
+
$header = new Header($h->getKey(), $h->getValue());
|
578 |
+
} else {
|
579 |
+
$header = new Header($key, $value);
|
580 |
+
}
|
581 |
+
if ($personalization != null) {
|
582 |
+
$personalization->addHeader($header);
|
583 |
+
$this->addPersonalization($personalization);
|
584 |
+
return;
|
585 |
+
} else {
|
586 |
+
if ($this->personalization[0] != null) {
|
587 |
+
$this->personalization[0]->addHeader($header);
|
588 |
+
} else if ($this->personalization[$personalizationIndex] != null) {
|
589 |
+
$this->personalization[$personalizationIndex]->addHeader($header);
|
590 |
+
} else {
|
591 |
+
$personalization = new Personalization();
|
592 |
+
$personalization->addHeader($header);
|
593 |
+
if (($personalizationIndex != 0)
|
594 |
+
&& ($this->getPersonalizationCount() <= $personalizationIndex)
|
595 |
+
) {
|
596 |
+
$this->personalization[$personalizationIndex] = $personalization;
|
597 |
+
} else {
|
598 |
+
$this->addPersonalization($personalization);
|
599 |
+
}
|
600 |
+
}
|
601 |
+
return;
|
602 |
+
}
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Adds multiple headers to a Personalization or Mail object
|
607 |
+
*
|
608 |
+
* If you don't provide a Personalization object or index, the
|
609 |
+
* header will be global to entire message. Note that
|
610 |
+
* headers added to Personalization objects override
|
611 |
+
* global headers.
|
612 |
+
*
|
613 |
+
* @param array|Header[] $headers Array of Header objects
|
614 |
+
* or key values
|
615 |
+
* @param int|null $personalizationIndex Index into an array of
|
616 |
+
* existing Personalization
|
617 |
+
* objects
|
618 |
+
* @param Personalization|null $personalization A pre-created
|
619 |
+
* Personalization object
|
620 |
+
*/
|
621 |
+
public function addHeaders(
|
622 |
+
$headers,
|
623 |
+
$personalizationIndex = null,
|
624 |
+
$personalization = null
|
625 |
+
) {
|
626 |
+
if (current($headers) instanceof Header) {
|
627 |
+
foreach ($headers as $header) {
|
628 |
+
$this->addHeader($header);
|
629 |
+
}
|
630 |
+
} else {
|
631 |
+
foreach ($headers as $key => $value) {
|
632 |
+
$this->addHeader(
|
633 |
+
$key,
|
634 |
+
$value,
|
635 |
+
$personalizationIndex,
|
636 |
+
$personalization
|
637 |
+
);
|
638 |
+
}
|
639 |
+
}
|
640 |
+
}
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Retrieve the headers attached to a Personalization object
|
644 |
+
*
|
645 |
+
* @param int|0 $personalizationIndex Index into an array of
|
646 |
+
* existing Personalization
|
647 |
+
* objects
|
648 |
+
*
|
649 |
+
* @return Header[]
|
650 |
+
*/
|
651 |
+
public function getHeaders($personalizationIndex = 0)
|
652 |
+
{
|
653 |
+
return $this->personalization[$personalizationIndex]->getHeaders();
|
654 |
+
}
|
655 |
+
|
656 |
+
/**
|
657 |
+
* Add a DynamicTemplateData object or key/value to a Personalization object
|
658 |
+
*
|
659 |
+
* @param DynamicTemplateData|string $data DynamicTemplateData object or the key of a
|
660 |
+
* dynamic data
|
661 |
+
* @param string|null $value Value
|
662 |
+
* @param int|null $personalizationIndex Index into an array of
|
663 |
+
* existing Personalization
|
664 |
+
* objects
|
665 |
+
* @param Personalization|null $personalization A pre-created
|
666 |
+
* Personalization object
|
667 |
+
*/
|
668 |
+
public function addDynamicTemplateData(
|
669 |
+
$key,
|
670 |
+
$value = null,
|
671 |
+
$personalizationIndex = null,
|
672 |
+
$personalization = null
|
673 |
+
) {
|
674 |
+
$this->addSubstitution($key, $value, $personalizationIndex, $personalization);
|
675 |
+
}
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Add a DynamicTemplateData object or key/value to a Personalization object
|
679 |
+
*
|
680 |
+
* @param array|DynamicTemplateData[] $data Array of DynamicTemplateData objects or key/values
|
681 |
+
* @param int|null $personalizationIndex Index into an array of
|
682 |
+
* existing Personalization
|
683 |
+
* objects
|
684 |
+
* @param Personalization|null $personalization A pre-created
|
685 |
+
* Personalization object
|
686 |
+
*/
|
687 |
+
public function addDynamicTemplateDatas(
|
688 |
+
$datas,
|
689 |
+
$personalizationIndex = null,
|
690 |
+
$personalization = null
|
691 |
+
) {
|
692 |
+
$this->addSubstitutions($datas);
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Retrieve dynamic template data key/value pairs from a Personalization object
|
697 |
+
*
|
698 |
+
* @param int|0 $personalizationIndex Index into an array of
|
699 |
+
* existing Personalization
|
700 |
+
* objects
|
701 |
+
*
|
702 |
+
* @return array
|
703 |
+
*/
|
704 |
+
public function getDynamicTemplateDatas($personalizationIndex = 0)
|
705 |
+
{
|
706 |
+
return $this->getSubstitutions($personalizationIndex);
|
707 |
+
}
|
708 |
+
|
709 |
+
/**
|
710 |
+
* Add a substitution to a Personalization or Mail object
|
711 |
+
*
|
712 |
+
* If you don't provide a Personalization object or index, the
|
713 |
+
* substitution will be global to entire message. Note that
|
714 |
+
* substitutions added to Personalization objects override
|
715 |
+
* global substitutions.
|
716 |
+
*
|
717 |
+
* @param string|Substitution $key Key or Substitution object
|
718 |
+
* @param string|null $value Value
|
719 |
+
* @param int|null $personalizationIndex Index into an array of
|
720 |
+
* existing Personalization
|
721 |
+
* objects
|
722 |
+
* @param Personalization|null $personalization A pre-created
|
723 |
+
* Personalization object
|
724 |
+
*
|
725 |
+
* @return null
|
726 |
+
*/
|
727 |
+
public function addSubstitution(
|
728 |
+
$key,
|
729 |
+
$value = null,
|
730 |
+
$personalizationIndex = null,
|
731 |
+
$personalization = null
|
732 |
+
) {
|
733 |
+
$substitution = null;
|
734 |
+
if ($key instanceof Substitution) {
|
735 |
+
$s = $key;
|
736 |
+
$substitution = new Substitution($s->getKey(), $s->getValue());
|
737 |
+
} else {
|
738 |
+
$substitution = new Substitution($key, $value);
|
739 |
+
}
|
740 |
+
if ($personalization != null) {
|
741 |
+
$personalization->addSubstitution($substitution);
|
742 |
+
$this->addPersonalization($personalization);
|
743 |
+
return;
|
744 |
+
} else {
|
745 |
+
if ($this->personalization[0] != null) {
|
746 |
+
$this->personalization[0]->addSubstitution($substitution);
|
747 |
+
} else if ($this->personalization[$personalizationIndex] != null) {
|
748 |
+
$this->personalization[$personalizationIndex]->addSubstitution($substitution);
|
749 |
+
} else {
|
750 |
+
$personalization = new Personalization();
|
751 |
+
$personalization->addSubstitution($substitution);
|
752 |
+
if (($personalizationIndex != 0)
|
753 |
+
&& ($this->getPersonalizationCount() <= $personalizationIndex)
|
754 |
+
) {
|
755 |
+
$this->personalization[$personalizationIndex] = $personalization;
|
756 |
+
} else {
|
757 |
+
$this->addPersonalization($personalization);
|
758 |
+
}
|
759 |
+
}
|
760 |
+
return;
|
761 |
+
}
|
762 |
+
}
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Adds multiple substitutions to a Personalization or Mail object
|
766 |
+
*
|
767 |
+
* If you don't provide a Personalization object or index, the
|
768 |
+
* substitution will be global to entire message. Note that
|
769 |
+
* substitutions added to Personalization objects override
|
770 |
+
* global headers.
|
771 |
+
*
|
772 |
+
* @param array|Substitution[] $substitutions Array of Substitution
|
773 |
+
* objects or key/values
|
774 |
+
* @param int|null $personalizationIndex Index into an array of
|
775 |
+
* existing Personalization
|
776 |
+
* objects
|
777 |
+
* @param Personalization|null $personalization A pre-created
|
778 |
+
* ersonalization object
|
779 |
+
*/
|
780 |
+
public function addSubstitutions(
|
781 |
+
$substitutions,
|
782 |
+
$personalizationIndex = null,
|
783 |
+
$personalization = null
|
784 |
+
) {
|
785 |
+
if (current($substitutions) instanceof Substitution) {
|
786 |
+
foreach ($substitutions as $substitution) {
|
787 |
+
$this->addSubstitution($substitution);
|
788 |
+
}
|
789 |
+
} else {
|
790 |
+
foreach ($substitutions as $key => $value) {
|
791 |
+
$this->addSubstitution(
|
792 |
+
$key,
|
793 |
+
$value,
|
794 |
+
$personalizationIndex,
|
795 |
+
$personalization
|
796 |
+
);
|
797 |
+
}
|
798 |
+
}
|
799 |
+
}
|
800 |
+
|
801 |
+
/**
|
802 |
+
* Retrieve the substitutions attached to a Personalization object
|
803 |
+
*
|
804 |
+
* @param int|0 $personalizationIndex Index into an array of
|
805 |
+
* existing Personalization
|
806 |
+
* objects
|
807 |
+
*
|
808 |
+
* @return Substitution[]
|
809 |
+
*/
|
810 |
+
public function getSubstitutions($personalizationIndex = 0)
|
811 |
+
{
|
812 |
+
return $this->personalization[$personalizationIndex]->getSubstitutions();
|
813 |
+
}
|
814 |
+
|
815 |
+
/**
|
816 |
+
* Add a custom arg to a Personalization or Mail object
|
817 |
+
*
|
818 |
+
* Note that custom args added to Personalization objects
|
819 |
+
* override global custom args.
|
820 |
+
*
|
821 |
+
* @param string|CustomArg $key Key or CustomArg object
|
822 |
+
* @param string|null $value Value
|
823 |
+
* @param int|null $personalizationIndex Index into an array of
|
824 |
+
* existing Personalization
|
825 |
+
* objects
|
826 |
+
* @param Personalization|null $personalization A pre-created
|
827 |
+
* Personalization object
|
828 |
+
*/
|
829 |
+
public function addCustomArg(
|
830 |
+
$key,
|
831 |
+
$value = null,
|
832 |
+
$personalizationIndex = null,
|
833 |
+
$personalization = null
|
834 |
+
) {
|
835 |
+
$custom_arg = null;
|
836 |
+
if ($key instanceof CustomArg) {
|
837 |
+
$ca = $key;
|
838 |
+
$custom_arg = new CustomArg($ca->getKey(), $ca->getValue());
|
839 |
+
} else {
|
840 |
+
$custom_arg = new CustomArg($key, $value);
|
841 |
+
}
|
842 |
+
if ($personalization != null) {
|
843 |
+
$personalization->addCustomArg($custom_arg);
|
844 |
+
$this->addPersonalization($personalization);
|
845 |
+
return;
|
846 |
+
} else {
|
847 |
+
if ($this->personalization[0] != null) {
|
848 |
+
$this->personalization[0]->addCustomArg($custom_arg);
|
849 |
+
} else if ($this->personalization[$personalizationIndex] != null) {
|
850 |
+
$this->personalization[$personalizationIndex]->addCustomArg(
|
851 |
+
$custom_arg
|
852 |
+
);
|
853 |
+
} else {
|
854 |
+
$personalization = new Personalization();
|
855 |
+
$personalization->addCustomArg($custom_arg);
|
856 |
+
if (($personalizationIndex != 0)
|
857 |
+
&& ($this->getPersonalizationCount() <= $personalizationIndex)
|
858 |
+
) {
|
859 |
+
$this->personalization[$personalizationIndex] = $personalization;
|
860 |
+
} else {
|
861 |
+
$this->addPersonalization($personalization);
|
862 |
+
}
|
863 |
+
}
|
864 |
+
return;
|
865 |
+
}
|
866 |
+
}
|
867 |
+
|
868 |
+
/**
|
869 |
+
* Adds multiple custom args to a Personalization or Mail object
|
870 |
+
*
|
871 |
+
* If you don't provide a Personalization object or index, the
|
872 |
+
* custom arg will be global to entire message. Note that
|
873 |
+
* custom args added to Personalization objects override
|
874 |
+
* global custom args.
|
875 |
+
*
|
876 |
+
* @param array|CustomArg[] $custom_args Array of CustomArg objects
|
877 |
+
* or key/values
|
878 |
+
* @param int|null $personalizationIndex Index into an array of
|
879 |
+
* existing Personalization
|
880 |
+
* objects
|
881 |
+
* @param Personalization|null $personalization A pre-created
|
882 |
+
* Personalization object
|
883 |
+
*/
|
884 |
+
public function addCustomArgs(
|
885 |
+
$custom_args,
|
886 |
+
$personalizationIndex = null,
|
887 |
+
$personalization = null
|
888 |
+
) {
|
889 |
+
if (current($custom_args) instanceof CustomArg) {
|
890 |
+
foreach ($custom_args as $custom_arg) {
|
891 |
+
$this->addCustomArg($custom_arg);
|
892 |
+
}
|
893 |
+
} else {
|
894 |
+
foreach ($custom_args as $key => $value) {
|
895 |
+
$this->addCustomArg(
|
896 |
+
$key,
|
897 |
+
$value,
|
898 |
+
$personalizationIndex,
|
899 |
+
$personalization
|
900 |
+
);
|
901 |
+
}
|
902 |
+
}
|
903 |
+
}
|
904 |
+
|
905 |
+
/**
|
906 |
+
* Retrieve the custom args attached to a Personalization object
|
907 |
+
*
|
908 |
+
* @param int|0 $personalizationIndex Index into an array of
|
909 |
+
* existing Personalization
|
910 |
+
* objects
|
911 |
+
*
|
912 |
+
* @return CustomArg[]
|
913 |
+
*/
|
914 |
+
public function getCustomArgs($personalizationIndex = 0)
|
915 |
+
{
|
916 |
+
return $this->personalization[$personalizationIndex]->getCustomArgs();
|
917 |
+
}
|
918 |
+
|
919 |
+
/**
|
920 |
+
* Add a unix timestamp allowing you to specify when you want your
|
921 |
+
* email to be delivered to a Personalization or Mail object
|
922 |
+
*
|
923 |
+
* If you don't provide a Personalization object or index, the
|
924 |
+
* send at timestamp will be global to entire message. Note that
|
925 |
+
* timestamps added to Personalization objects override
|
926 |
+
* global timestamps.
|
927 |
+
*
|
928 |
+
* @param int|SendAt $send_at A unix timestamp
|
929 |
+
* @param int|null $personalizationIndex Index into an array of
|
930 |
+
* existing Personalization
|
931 |
+
* objects
|
932 |
+
* @param Personalization|null $personalization A pre-created
|
933 |
+
* Personalization object
|
934 |
+
*/
|
935 |
+
public function setSendAt(
|
936 |
+
$send_at,
|
937 |
+
$personalizationIndex = null,
|
938 |
+
$personalization = null
|
939 |
+
) {
|
940 |
+
if (!($send_at instanceof SendAt)) {
|
941 |
+
$send_at = new SendAt($send_at);
|
942 |
+
}
|
943 |
+
if ($personalization != null) {
|
944 |
+
$personalization->setSendAt($send_at);
|
945 |
+
$this->addPersonalization($personalization);
|
946 |
+
return;
|
947 |
+
} else {
|
948 |
+
if ($this->personalization[0] != null) {
|
949 |
+
$this->personalization[0]->setSendAt($send_at);
|
950 |
+
return;
|
951 |
+
} else if ($this->personalization[$personalizationIndex] != null) {
|
952 |
+
$this->personalization[$personalizationIndex]->setSendAt($send_at);
|
953 |
+
return;
|
954 |
+
} else {
|
955 |
+
$personalization = new Personalization();
|
956 |
+
$personalization->setSendAt($send_at);
|
957 |
+
if (($personalizationIndex != 0)
|
958 |
+
&& ($this->getPersonalizationCount() <= $personalizationIndex)
|
959 |
+
) {
|
960 |
+
$this->personalization[$personalizationIndex] = $personalization;
|
961 |
+
} else {
|
962 |
+
$this->addPersonalization($personalization);
|
963 |
+
}
|
964 |
+
return;
|
965 |
+
}
|
966 |
+
}
|
967 |
+
}
|
968 |
+
|
969 |
+
/**
|
970 |
+
* Retrieve the unix timestamp attached to a Personalization object
|
971 |
+
*
|
972 |
+
* @param int|0 $personalizationIndex Index into an array of
|
973 |
+
* existing Personalization
|
974 |
+
* objects
|
975 |
+
*
|
976 |
+
* @return SendAt
|
977 |
+
*/
|
978 |
+
public function getSendAt($personalizationIndex = 0)
|
979 |
+
{
|
980 |
+
return $this->personalization[$personalizationIndex]->getSendAt();
|
981 |
+
}
|
982 |
+
|
983 |
+
/**
|
984 |
+
* Add the sender email address to a Mail object
|
985 |
+
*
|
986 |
+
* @param string|From $email Email address or From object
|
987 |
+
* @param string|null $name Sender name
|
988 |
+
*
|
989 |
+
* @throws TypeException
|
990 |
+
*/
|
991 |
+
public function setFrom($email, $name = null)
|
992 |
+
{
|
993 |
+
if ($email instanceof From) {
|
994 |
+
$this->from = $email;
|
995 |
+
} else {
|
996 |
+
|
997 |
+
if (
|
998 |
+
is_string($email) && filter_var($email, FILTER_VALIDATE_EMAIL)
|
999 |
+
) {
|
1000 |
+
$this->from = new From($email, $name);
|
1001 |
+
} else {
|
1002 |
+
throw new TypeException(
|
1003 |
+
'$email must be valid and of type string.'
|
1004 |
+
);
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
}
|
1008 |
+
return;
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
/**
|
1012 |
+
* Retrieve the sender attached to a Mail object
|
1013 |
+
*
|
1014 |
+
* @return From
|
1015 |
+
*/
|
1016 |
+
public function getFrom()
|
1017 |
+
{
|
1018 |
+
return $this->from;
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
/**
|
1022 |
+
* Add the reply to email address to a Mail object
|
1023 |
+
*
|
1024 |
+
* @param string|ReplyTo $email Email address or From object
|
1025 |
+
* @param string|null $name Reply to name
|
1026 |
+
*/
|
1027 |
+
public function setReplyTo($email, $name = null)
|
1028 |
+
{
|
1029 |
+
if ($email instanceof ReplyTo) {
|
1030 |
+
$this->reply_to = $email;
|
1031 |
+
} else {
|
1032 |
+
$this->reply_to = new ReplyTo($email, $name);
|
1033 |
+
}
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
/**
|
1037 |
+
* Retrieve the reply to information attached to a Mail object
|
1038 |
+
*
|
1039 |
+
* @return ReplyTo
|
1040 |
+
*/
|
1041 |
+
public function getReplyTo()
|
1042 |
+
{
|
1043 |
+
return $this->reply_to;
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
|
1047 |
+
/**
|
1048 |
+
* Add a subject to a Mail object
|
1049 |
+
*
|
1050 |
+
* Note that
|
1051 |
+
* subjects added to Personalization objects override
|
1052 |
+
* global subjects.
|
1053 |
+
*
|
1054 |
+
* @param string|Subject $subject Email subject
|
1055 |
+
*/
|
1056 |
+
public function setGlobalSubject($subject)
|
1057 |
+
{
|
1058 |
+
if (!($subject instanceof Subject)) {
|
1059 |
+
$subject = new Subject($subject);
|
1060 |
+
}
|
1061 |
+
$this->subject = $subject;
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
/**
|
1065 |
+
* Retrieve a subject attached to a Mail object
|
1066 |
+
*
|
1067 |
+
* @return Subject
|
1068 |
+
*/
|
1069 |
+
public function getGlobalSubject()
|
1070 |
+
{
|
1071 |
+
return $this->subject;
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
/**
|
1075 |
+
* Add content to a Mail object
|
1076 |
+
*
|
1077 |
+
* For a list of pre-configured mime types, please see
|
1078 |
+
* MimeType.php
|
1079 |
+
*
|
1080 |
+
* @param string|Content $type Mime type or Content object
|
1081 |
+
* @param string|null $value Contents (e.g. text or html)
|
1082 |
+
*/
|
1083 |
+
public function addContent($type, $value = null)
|
1084 |
+
{
|
1085 |
+
if ($type instanceof Content) {
|
1086 |
+
$content = $type;
|
1087 |
+
} else {
|
1088 |
+
$content = new Content($type, $value);
|
1089 |
+
}
|
1090 |
+
$this->contents[] = $content;
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
/**
|
1094 |
+
* Adds multiple Content objects to a Mail object
|
1095 |
+
*
|
1096 |
+
* @param array|Content[] $contents Array of Content objects
|
1097 |
+
* or key value pairs
|
1098 |
+
*/
|
1099 |
+
public function addContents($contents)
|
1100 |
+
{
|
1101 |
+
if (current($contents) instanceof Content) {
|
1102 |
+
foreach ($contents as $content) {
|
1103 |
+
$this->addContent($content);
|
1104 |
+
}
|
1105 |
+
} else {
|
1106 |
+
foreach ($contents as $key => $value) {
|
1107 |
+
$this->addContent($key, $value);
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* Retrieve the contents attached to a Mail object
|
1114 |
+
*
|
1115 |
+
* Will return array of Content Objects with text/plain MimeType first
|
1116 |
+
* Array re-ordered before return where this is not already the case
|
1117 |
+
*
|
1118 |
+
* @return Content[]
|
1119 |
+
*/
|
1120 |
+
public function getContents()
|
1121 |
+
{
|
1122 |
+
if ($this->contents) {
|
1123 |
+
if ($this->contents[0]->getType() !== 'text/plain'
|
1124 |
+
&& count($this->contents) > 1
|
1125 |
+
) {
|
1126 |
+
foreach ($this->contents as $key => $value) {
|
1127 |
+
if ($value->getType() == 'text/plain') {
|
1128 |
+
$plain_content = $value;
|
1129 |
+
unset($this->contents[$key]);
|
1130 |
+
break;
|
1131 |
+
}
|
1132 |
+
}
|
1133 |
+
array_unshift($this->contents, $plain_content);
|
1134 |
+
}
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
return $this->contents;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
/**
|
1141 |
+
* Add an attachment to a Mail object
|
1142 |
+
*
|
1143 |
+
* @param string|Attachment $attachment Attachment object or
|
1144 |
+
* Base64 encoded content
|
1145 |
+
* @param string|null $type Mime type of the attachment
|
1146 |
+
* @param string|null $filename File name of the attachment
|
1147 |
+
* @param string|null $disposition How the attachment should be
|
1148 |
+
* displayed: inline or attachment
|
1149 |
+
* default is attachment
|
1150 |
+
* @param string|null $content_id Used when disposition is inline
|
1151 |
+
* to diplay the file within the
|
1152 |
+
* body of the email
|
1153 |
+
*/
|
1154 |
+
public function addAttachment(
|
1155 |
+
$attachment,
|
1156 |
+
$type = null,
|
1157 |
+
$filename = null,
|
1158 |
+
$disposition = null,
|
1159 |
+
$content_id = null
|
1160 |
+
) {
|
1161 |
+
if (is_array($attachment)) {
|
1162 |
+
$attachment = new Attachment(
|
1163 |
+
$attachment[0],
|
1164 |
+
$attachment[1],
|
1165 |
+
$attachment[2],
|
1166 |
+
$attachment[3],
|
1167 |
+
$attachment[4]
|
1168 |
+
);
|
1169 |
+
} else if (!($attachment instanceof Attachment)) {
|
1170 |
+
$attachment = new Attachment(
|
1171 |
+
$attachment,
|
1172 |
+
$type,
|
1173 |
+
$filename,
|
1174 |
+
$disposition,
|
1175 |
+
$content_id
|
1176 |
+
);
|
1177 |
+
}
|
1178 |
+
$this->attachments[] = $attachment;
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
/**
|
1182 |
+
* Adds multiple attachments to a Mail object
|
1183 |
+
*
|
1184 |
+
* @param array|Attachment[] $attachments Array of Attachment objects
|
1185 |
+
* or arrays
|
1186 |
+
*/
|
1187 |
+
public function addAttachments($attachments)
|
1188 |
+
{
|
1189 |
+
foreach ($attachments as $attachment) {
|
1190 |
+
$this->addAttachment($attachment);
|
1191 |
+
}
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
/**
|
1195 |
+
* Retrieve the attachments attached to a Mail object
|
1196 |
+
*
|
1197 |
+
* @return Attachment[]
|
1198 |
+
*/
|
1199 |
+
public function getAttachments()
|
1200 |
+
{
|
1201 |
+
return $this->attachments;
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
/**
|
1205 |
+
* Add a template id to a Mail object
|
1206 |
+
*
|
1207 |
+
* @param string $template_id The id of the template to be
|
1208 |
+
* appied to this email
|
1209 |
+
*/
|
1210 |
+
public function setTemplateId($template_id)
|
1211 |
+
{
|
1212 |
+
if (!($template_id instanceof TemplateId)) {
|
1213 |
+
$template_id = new TemplateId($template_id);
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
$this->template_id = $template_id;
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
/**
|
1220 |
+
* Retrieve a template id attached to a Mail object
|
1221 |
+
*
|
1222 |
+
* @return TemplateId
|
1223 |
+
*/
|
1224 |
+
public function getTemplateId()
|
1225 |
+
{
|
1226 |
+
return $this->template_id;
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
/**
|
1230 |
+
* Add a section to a Mail object
|
1231 |
+
*
|
1232 |
+
* @param string|Section $key Key or Section object
|
1233 |
+
* @param string|null $value Value
|
1234 |
+
*/
|
1235 |
+
public function addSection($key, $value = null)
|
1236 |
+
{
|
1237 |
+
if ($key instanceof Section) {
|
1238 |
+
$section = $key;
|
1239 |
+
$this->sections[$section->getKey()]
|
1240 |
+
= $section->getValue();
|
1241 |
+
return;
|
1242 |
+
}
|
1243 |
+
$this->sections[$key] = (string)$value;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
/**
|
1247 |
+
* Adds multiple sections to a Mail object
|
1248 |
+
*
|
1249 |
+
* @param array|Section[] $sections Array of CustomArg objects
|
1250 |
+
* or key/values
|
1251 |
+
*/
|
1252 |
+
public function addSections($sections)
|
1253 |
+
{
|
1254 |
+
if (current($sections) instanceof Section) {
|
1255 |
+
foreach ($sections as $section) {
|
1256 |
+
$this->addSection($section);
|
1257 |
+
}
|
1258 |
+
} else {
|
1259 |
+
foreach ($sections as $key => $value) {
|
1260 |
+
$this->addSection($key, $value);
|
1261 |
+
}
|
1262 |
+
}
|
1263 |
+
}
|
1264 |
+
|
1265 |
+
/**
|
1266 |
+
* Retrieve the section(s) attached to a Mail object
|
1267 |
+
*
|
1268 |
+
* @return Section[]
|
1269 |
+
*/
|
1270 |
+
public function getSections()
|
1271 |
+
{
|
1272 |
+
return $this->sections;
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
/**
|
1276 |
+
* Add a header to a Mail object
|
1277 |
+
*
|
1278 |
+
* Note that headers added to Personalization objects override
|
1279 |
+
* global headers.
|
1280 |
+
*
|
1281 |
+
* @param string|Header $key Key or Header object
|
1282 |
+
* @param string|null $value Value
|
1283 |
+
*/
|
1284 |
+
public function addGlobalHeader($key, $value = null)
|
1285 |
+
{
|
1286 |
+
if ($key instanceof Header) {
|
1287 |
+
$header = $key;
|
1288 |
+
$this->headers[$header->getKey()]
|
1289 |
+
= $header->getValue();
|
1290 |
+
return;
|
1291 |
+
}
|
1292 |
+
$this->headers[$key] = (string)$value;
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
/**
|
1296 |
+
* Adds multiple headers to a Mail object
|
1297 |
+
*
|
1298 |
+
* Note that headers added to Personalization objects override
|
1299 |
+
* global headers.
|
1300 |
+
*
|
1301 |
+
* @param array|Header[] $headers Array of Header objects
|
1302 |
+
* or key values
|
1303 |
+
*/
|
1304 |
+
public function addGlobalHeaders($headers)
|
1305 |
+
{
|
1306 |
+
if (current($headers) instanceof Header) {
|
1307 |
+
foreach ($headers as $header) {
|
1308 |
+
$this->addGlobalHeader($header);
|
1309 |
+
}
|
1310 |
+
} else {
|
1311 |
+
foreach ($headers as $key => $value) {
|
1312 |
+
$this->addGlobalHeader($key, $value);
|
1313 |
+
}
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
/**
|
1318 |
+
* Retrieve the headers attached to a Mail object
|
1319 |
+
*
|
1320 |
+
* @return Header[]
|
1321 |
+
*/
|
1322 |
+
public function getGlobalHeaders()
|
1323 |
+
{
|
1324 |
+
return $this->headers;
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
/**
|
1328 |
+
* Add a substitution to a Mail object
|
1329 |
+
*
|
1330 |
+
* Note that substitutions added to Personalization objects override
|
1331 |
+
* global substitutions.
|
1332 |
+
*
|
1333 |
+
* @param string|Substitution $key Key or Substitution object
|
1334 |
+
* @param string|null $value Value
|
1335 |
+
*/
|
1336 |
+
public function addGlobalSubstitution($key, $value = null)
|
1337 |
+
{
|
1338 |
+
if ($key instanceof Substitution) {
|
1339 |
+
$substitution = $key;
|
1340 |
+
$this->substitutions[$substitution->getKey()]
|
1341 |
+
= $substitution->getValue();
|
1342 |
+
return;
|
1343 |
+
}
|
1344 |
+
$this->substitutions[$key] = $value;
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
/**
|
1348 |
+
* Adds multiple substitutions to a Mail object
|
1349 |
+
*
|
1350 |
+
* Note that substitutions added to Personalization objects override
|
1351 |
+
* global headers.
|
1352 |
+
*
|
1353 |
+
* @param array|Substitution[] $substitutions Array of Substitution
|
1354 |
+
* objects or key/values
|
1355 |
+
*/
|
1356 |
+
public function addGlobalSubstitutions($substitutions)
|
1357 |
+
{
|
1358 |
+
if (current($substitutions) instanceof Substitution) {
|
1359 |
+
foreach ($substitutions as $substitution) {
|
1360 |
+
$this->addGlobalSubstitution($substitution);
|
1361 |
+
}
|
1362 |
+
} else {
|
1363 |
+
foreach ($substitutions as $key => $value) {
|
1364 |
+
$this->addGlobalSubstitution($key, $value);
|
1365 |
+
}
|
1366 |
+
}
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
/**
|
1370 |
+
* Retrieve the substitutions attached to a Mail object
|
1371 |
+
*
|
1372 |
+
* @return Substitution[]
|
1373 |
+
*/
|
1374 |
+
public function getGlobalSubstitutions()
|
1375 |
+
{
|
1376 |
+
return $this->substitutions;
|
1377 |
+
}
|
1378 |
+
|
1379 |
+
/**
|
1380 |
+
* Add a category to a Mail object
|
1381 |
+
*
|
1382 |
+
* @param string|Category $category Category object or category name
|
1383 |
+
*/
|
1384 |
+
public function addCategory($category)
|
1385 |
+
{
|
1386 |
+
if (!($category instanceof Category)) {
|
1387 |
+
$category = new Category($category);
|
1388 |
+
}
|
1389 |
+
$this->categories[] = $category;
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
/**
|
1393 |
+
* Adds multiple categories to a Mail object
|
1394 |
+
*
|
1395 |
+
* @param array|Category[] $categories Array of Category objects
|
1396 |
+
* or arrays
|
1397 |
+
*/
|
1398 |
+
public function addCategories($categories)
|
1399 |
+
{
|
1400 |
+
foreach ($categories as $category) {
|
1401 |
+
$this->addCategory($category);
|
1402 |
+
}
|
1403 |
+
return;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
/**
|
1407 |
+
* Retrieve the categories attached to a Mail object
|
1408 |
+
*
|
1409 |
+
* @return Category[]
|
1410 |
+
*/
|
1411 |
+
public function getCategories()
|
1412 |
+
{
|
1413 |
+
return $this->categories;
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
/**
|
1417 |
+
* Add a custom arg to a Mail object
|
1418 |
+
*
|
1419 |
+
* Note that custom args added to Personalization objects override
|
1420 |
+
* global custom args.
|
1421 |
+
*
|
1422 |
+
* @param string|CustomArg $key Key or CustomArg object
|
1423 |
+
* @param string|null $value Value
|
1424 |
+
*/
|
1425 |
+
public function addGlobalCustomArg($key, $value = null)
|
1426 |
+
{
|
1427 |
+
if ($key instanceof CustomArg) {
|
1428 |
+
$custom_arg = $key;
|
1429 |
+
$this->custom_args[$custom_arg->getKey()]
|
1430 |
+
= $custom_arg->getValue();
|
1431 |
+
return;
|
1432 |
+
}
|
1433 |
+
$this->custom_args[$key] = (string)$value;
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
/**
|
1437 |
+
* Adds multiple custom args to a Mail object
|
1438 |
+
*
|
1439 |
+
* Note that custom args added to Personalization objects override
|
1440 |
+
* global custom args.
|
1441 |
+
*
|
1442 |
+
* @param array|CustomArg[] $custom_args Array of CustomArg objects
|
1443 |
+
* or key/values
|
1444 |
+
*/
|
1445 |
+
public function addGlobalCustomArgs($custom_args)
|
1446 |
+
{
|
1447 |
+
if (current($custom_args) instanceof CustomArg) {
|
1448 |
+
foreach ($custom_args as $custom_arg) {
|
1449 |
+
$this->addGlobalCustomArg($custom_arg);
|
1450 |
+
}
|
1451 |
+
} else {
|
1452 |
+
foreach ($custom_args as $key => $value) {
|
1453 |
+
$this->addGlobalCustomArg($key, $value);
|
1454 |
+
}
|
1455 |
+
}
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
/**
|
1459 |
+
* Retrieve the custom args attached to a Mail object
|
1460 |
+
*
|
1461 |
+
* @return CustomArg[]
|
1462 |
+
*/
|
1463 |
+
public function getGlobalCustomArgs()
|
1464 |
+
{
|
1465 |
+
return $this->custom_args;
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
/**
|
1469 |
+
* Add a unix timestamp allowing you to specify when you want your
|
1470 |
+
* email to be delivered to a Mail object
|
1471 |
+
*
|
1472 |
+
* Note that timestamps added to Personalization objects override
|
1473 |
+
* global timestamps.
|
1474 |
+
*
|
1475 |
+
* @param int|SendAt $send_at A unix timestamp
|
1476 |
+
*/
|
1477 |
+
public function setGlobalSendAt($send_at)
|
1478 |
+
{
|
1479 |
+
if (!($send_at instanceof SendAt)) {
|
1480 |
+
$send_at = new SendAt($send_at);
|
1481 |
+
}
|
1482 |
+
$this->send_at = $send_at;
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
/**
|
1486 |
+
* Retrieve the unix timestamp attached to a Mail object
|
1487 |
+
*
|
1488 |
+
* @return SendAt
|
1489 |
+
*/
|
1490 |
+
public function getGlobalSendAt()
|
1491 |
+
{
|
1492 |
+
return $this->send_at;
|
1493 |
+
}
|
1494 |
+
|
1495 |
+
/**
|
1496 |
+
* Add a batch id to a Mail object
|
1497 |
+
*
|
1498 |
+
* @param string|BatchId $batch_id Id for a batch of emails
|
1499 |
+
* to be sent at the same time
|
1500 |
+
*/
|
1501 |
+
public function setBatchId($batch_id)
|
1502 |
+
{
|
1503 |
+
if (!($batch_id instanceof BatchId)) {
|
1504 |
+
$batch_id = new BatchId($batch_id);
|
1505 |
+
}
|
1506 |
+
$this->batch_id = $batch_id;
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
/**
|
1510 |
+
* Retrieve the batch id attached to a Mail object
|
1511 |
+
*
|
1512 |
+
* @return BatchId
|
1513 |
+
*/
|
1514 |
+
public function getBatchId()
|
1515 |
+
{
|
1516 |
+
return $this->batch_id;
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
/**
|
1520 |
+
* Add a Asm describing how to handle unsubscribes to a Mail object
|
1521 |
+
*
|
1522 |
+
* @param int|Asm $group_id Asm object or unsubscribe group id
|
1523 |
+
* to associate this email with
|
1524 |
+
* @param array $groups_to_display Array of integer ids of unsubscribe
|
1525 |
+
* groups to be displayed on the
|
1526 |
+
* unsubscribe preferences page
|
1527 |
+
*/
|
1528 |
+
public function setAsm($group_id, $groups_to_display = null)
|
1529 |
+
{
|
1530 |
+
if ($group_id instanceof Asm) {
|
1531 |
+
$asm = $group_id;
|
1532 |
+
$this->asm = $asm;
|
1533 |
+
} else {
|
1534 |
+
$this->asm = new Asm($group_id, $groups_to_display);
|
1535 |
+
}
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
/**
|
1539 |
+
* Retrieve the Asm object describing how to handle unsubscribes attached
|
1540 |
+
* to a Mail object
|
1541 |
+
*
|
1542 |
+
* @return Asm
|
1543 |
+
*/
|
1544 |
+
public function getAsm()
|
1545 |
+
{
|
1546 |
+
return $this->asm;
|
1547 |
+
}
|
1548 |
+
|
1549 |
+
/**
|
1550 |
+
* Add the IP pool name to a Mail object
|
1551 |
+
*
|
1552 |
+
* @param string|IpPoolName $ip_pool_name The IP Pool that you would
|
1553 |
+
* like to send this email from
|
1554 |
+
*/
|
1555 |
+
public function setIpPoolName($ip_pool_name)
|
1556 |
+
{
|
1557 |
+
if ($ip_pool_name instanceof IpPoolName) {
|
1558 |
+
$this->ip_pool_name = $ip_pool_name->getIpPoolName();
|
1559 |
+
} else {
|
1560 |
+
$this->ip_pool_name = new IpPoolName($ip_pool_name);
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
/**
|
1566 |
+
* Retrieve the IP pool name attached to a Mail object
|
1567 |
+
*
|
1568 |
+
* @return IpPoolName
|
1569 |
+
*/
|
1570 |
+
public function getIpPoolName()
|
1571 |
+
{
|
1572 |
+
return $this->ip_pool_name;
|
1573 |
+
}
|
1574 |
+
|
1575 |
+
/**
|
1576 |
+
* Add a MailSettings object to a Mail object
|
1577 |
+
*
|
1578 |
+
* @param MailSettings $mail_settings A collection of different
|
1579 |
+
* mail settings that you can
|
1580 |
+
* use to specify how you would
|
1581 |
+
* like this email to be handled
|
1582 |
+
* @throws TypeException
|
1583 |
+
*/
|
1584 |
+
public function setMailSettings($mail_settings)
|
1585 |
+
{
|
1586 |
+
if (!($mail_settings instanceof MailSettings)) {
|
1587 |
+
throw new TypeException(
|
1588 |
+
'$mail_settings must be an instance of SendGrid\Mail\MailSettings'
|
1589 |
+
);
|
1590 |
+
}
|
1591 |
+
$this->mail_settings = $mail_settings;
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
/**
|
1595 |
+
* Retrieve the MailSettings object attached to a Mail object
|
1596 |
+
*
|
1597 |
+
* @return MailSettings
|
1598 |
+
*/
|
1599 |
+
public function getMailSettings()
|
1600 |
+
{
|
1601 |
+
return $this->mail_settings;
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
/**
|
1605 |
+
* Set the Bcc settings on a MailSettings object
|
1606 |
+
*
|
1607 |
+
* @param bool|BccSettings $enable A BccSettings object or a boolean
|
1608 |
+
* to determine if this setting is active
|
1609 |
+
* @param string|null $email The email address to be bcc'ed
|
1610 |
+
*/
|
1611 |
+
public function setBccSettings($enable, $email = null)
|
1612 |
+
{
|
1613 |
+
if (!($this->mail_settings instanceof MailSettings)) {
|
1614 |
+
$this->mail_settings = new MailSettings();
|
1615 |
+
}
|
1616 |
+
$this->mail_settings->setBccSettings($enable, $email);
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
/**
|
1620 |
+
* Enable bypass list management on a MailSettings object
|
1621 |
+
*
|
1622 |
+
* Allows you to bypass all unsubscribe groups and suppressions to ensure
|
1623 |
+
* that the email is delivered to every single recipient. This should only
|
1624 |
+
* be used in emergencies when it is absolutely necessary that every
|
1625 |
+
* recipient receives your email.
|
1626 |
+
*/
|
1627 |
+
public function enableBypassListManagement()
|
1628 |
+
{
|
1629 |
+
if (!$this->mail_settings instanceof MailSettings) {
|
1630 |
+
$this->mail_settings = new MailSettings();
|
1631 |
+
}
|
1632 |
+
$this->mail_settings->setBypassListManagement(true);
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
/**
|
1636 |
+
* Disable bypass list management on a MailSettings object
|
1637 |
+
*
|
1638 |
+
* Allows you to bypass all unsubscribe groups and suppressions to ensure
|
1639 |
+
* that the email is delivered to every single recipient. This should only
|
1640 |
+
* be used in emergencies when it is absolutely necessary that every
|
1641 |
+
* recipient receives your email.
|
1642 |
+
*/
|
1643 |
+
public function disableBypassListManagement()
|
1644 |
+
{
|
1645 |
+
if (!($this->mail_settings instanceof MailSettings)) {
|
1646 |
+
$this->mail_settings = new MailSettings();
|
1647 |
+
}
|
1648 |
+
$this->mail_settings->setBypassListManagement(false);
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
/**
|
1652 |
+
* Set the Footer settings on a MailSettings object
|
1653 |
+
*
|
1654 |
+
* @param bool|Footer $enable A Footer object or a boolean
|
1655 |
+
* to determine if this setting is active
|
1656 |
+
* @param string|null $text The plain text content of the footer
|
1657 |
+
* @param string|null $html The HTML content of the footer
|
1658 |
+
*/
|
1659 |
+
public function setFooter($enable = null, $text = null, $html = null)
|
1660 |
+
{
|
1661 |
+
if (!$this->mail_settings instanceof MailSettings) {
|
1662 |
+
$this->mail_settings = new MailSettings();
|
1663 |
+
}
|
1664 |
+
$this->mail_settings->setFooter($enable, $text, $html);
|
1665 |
+
}
|
1666 |
+
|
1667 |
+
/**
|
1668 |
+
* Enable sandbox mode on a MailSettings object
|
1669 |
+
*
|
1670 |
+
* This allows you to send a test email to ensure that your request
|
1671 |
+
* body is valid and formatted correctly.
|
1672 |
+
*/
|
1673 |
+
public function enableSandBoxMode()
|
1674 |
+
{
|
1675 |
+
if (!($this->mail_settings instanceof MailSettings)) {
|
1676 |
+
$this->mail_settings = new MailSettings();
|
1677 |
+
}
|
1678 |
+
$this->mail_settings->setSandBoxMode(true);
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
/**
|
1682 |
+
* Disable sandbox mode on a MailSettings object
|
1683 |
+
*
|
1684 |
+
* This allows you to send a test email to ensure that your request
|
1685 |
+
* body is valid and formatted correctly.
|
1686 |
+
*/
|
1687 |
+
public function disableSandBoxMode()
|
1688 |
+
{
|
1689 |
+
if (!($this->mail_settings instanceof MailSettings)) {
|
1690 |
+
$this->mail_settings = new MailSettings();
|
1691 |
+
}
|
1692 |
+
$this->mail_settings->setSandBoxMode(false);
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
/**
|
1696 |
+
* Set the spam check settings on a MailSettings object
|
1697 |
+
*
|
1698 |
+
* @param bool|SpamCheck $enable A SpamCheck object or a boolean
|
1699 |
+
* to determine if this setting is active
|
1700 |
+
* @param int|null $threshold The threshold used to determine if your
|
1701 |
+
* content qualifies as spam on a scale from
|
1702 |
+
* 1 to 10, with 10 being most strict, or
|
1703 |
+
* most likely to be considered as spam
|
1704 |
+
* @param string|null $post_to_url An Inbound Parse URL that you would like
|
1705 |
+
* a copy of your email along with the spam
|
1706 |
+
* report to be sent to
|
1707 |
+
*/
|
1708 |
+
public function setSpamCheck($enable = null, $threshold = null, $post_to_url = null)
|
1709 |
+
{
|
1710 |
+
if (!$this->mail_settings instanceof MailSettings) {
|
1711 |
+
$this->mail_settings = new MailSettings();
|
1712 |
+
}
|
1713 |
+
$this->mail_settings->setSpamCheck($enable, $threshold, $post_to_url);
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
/**
|
1717 |
+
* Add a TrackingSettings object to a Mail object
|
1718 |
+
*
|
1719 |
+
* @param TrackingSettings $tracking_settings Settings to determine how you
|
1720 |
+
* would like to track the metrics
|
1721 |
+
* of how your recipients interact
|
1722 |
+
* with your email
|
1723 |
+
* @throws TypeException
|
1724 |
+
*/
|
1725 |
+
public function setTrackingSettings($tracking_settings)
|
1726 |
+
{
|
1727 |
+
if (!($tracking_settings instanceof TrackingSettings)) {
|
1728 |
+
throw new TypeException(
|
1729 |
+
'$tracking_settings must be an instance of SendGrid\Mail\TrackingSettings'
|
1730 |
+
);
|
1731 |
+
}
|
1732 |
+
$this->tracking_settings = $tracking_settings;
|
1733 |
+
}
|
1734 |
+
|
1735 |
+
/**
|
1736 |
+
* Retrieve the TrackingSettings object attached to a Mail object
|
1737 |
+
*
|
1738 |
+
* @return TrackingSettings
|
1739 |
+
*/
|
1740 |
+
public function getTrackingSettings()
|
1741 |
+
{
|
1742 |
+
return $this->tracking_settings;
|
1743 |
+
}
|
1744 |
+
|
1745 |
+
/**
|
1746 |
+
* Set the click tracking settings on a TrackingSettings object
|
1747 |
+
*
|
1748 |
+
* @param bool|ClickTracking $enable A ClickTracking object or a boolean
|
1749 |
+
* to determine if this setting is active
|
1750 |
+
* @param bool|null $enable_text Indicates if this setting should be
|
1751 |
+
* included in the text/plain portion of
|
1752 |
+
* your email
|
1753 |
+
*/
|
1754 |
+
public function setClickTracking($enable = null, $enable_text = null)
|
1755 |
+
{
|
1756 |
+
if (!($this->tracking_settings instanceof TrackingSettings)) {
|
1757 |
+
$this->tracking_settings = new TrackingSettings();
|
1758 |
+
}
|
1759 |
+
$this->tracking_settings->setClickTracking($enable, $enable_text);
|
1760 |
+
}
|
1761 |
+
|
1762 |
+
/**
|
1763 |
+
* Set the open tracking settings on a TrackingSettings object
|
1764 |
+
*
|
1765 |
+
* @param bool|OpenTracking $enable A OpenTracking object or a boolean
|
1766 |
+
* to determine if this setting is
|
1767 |
+
* active
|
1768 |
+
* @param string|null $substitution_tag Allows you to specify a
|
1769 |
+
* substitution tag that you can
|
1770 |
+
* insert in the body of your email
|
1771 |
+
* at a location that you desire.
|
1772 |
+
* This tag will be replaced by the
|
1773 |
+
* open tracking pixel
|
1774 |
+
*/
|
1775 |
+
public function setOpenTracking($enable = null, $substitution_tag = null)
|
1776 |
+
{
|
1777 |
+
if (!($this->tracking_settings instanceof TrackingSettings)) {
|
1778 |
+
$this->tracking_settings = new TrackingSettings();
|
1779 |
+
}
|
1780 |
+
$this->tracking_settings->setOpenTracking($enable, $substitution_tag);
|
1781 |
+
}
|
1782 |
+
|
1783 |
+
/**
|
1784 |
+
* Set the subscription tracking settings on a TrackingSettings object
|
1785 |
+
*
|
1786 |
+
* @param bool|SubscriptionTracking $enable A SubscriptionTracking
|
1787 |
+
* object or a boolean to
|
1788 |
+
* determine if this setting
|
1789 |
+
* is active
|
1790 |
+
* @param string|null $text Text to be appended to the
|
1791 |
+
* email, with the
|
1792 |
+
* subscription tracking
|
1793 |
+
* link. You may control
|
1794 |
+
* where the link is by using
|
1795 |
+
* the tag <% %>
|
1796 |
+
* @param string|null $html HTML to be appended to the
|
1797 |
+
* email, with the
|
1798 |
+
* subscription tracking
|
1799 |
+
* link. You may control
|
1800 |
+
* where the link is by using
|
1801 |
+
* the tag <% %>
|
1802 |
+
* @param string|null $substitution_tag A tag that will be
|
1803 |
+
* replaced with the
|
1804 |
+
* unsubscribe URL. for
|
1805 |
+
* example:
|
1806 |
+
* [unsubscribe_url]. If this
|
1807 |
+
* parameter is used, it will
|
1808 |
+
* override both the text and
|
1809 |
+
* html parameters. The URL
|
1810 |
+
* of the link will be placed
|
1811 |
+
* at the substitution tag’s
|
1812 |
+
* location, with no
|
1813 |
+
* additional formatting
|
1814 |
+
*/
|
1815 |
+
public function setSubscriptionTracking(
|
1816 |
+
$enable = null,
|
1817 |
+
$text = null,
|
1818 |
+
$html = null,
|
1819 |
+
$substitution_tag = null
|
1820 |
+
) {
|
1821 |
+
if (!($this->tracking_settings instanceof TrackingSettings)) {
|
1822 |
+
$this->tracking_settings = new TrackingSettings();
|
1823 |
+
}
|
1824 |
+
$this->tracking_settings->setSubscriptionTracking(
|
1825 |
+
$enable,
|
1826 |
+
$text,
|
1827 |
+
$html,
|
1828 |
+
$substitution_tag
|
1829 |
+
);
|
1830 |
+
}
|
1831 |
+
|
1832 |
+
/**
|
1833 |
+
* Set the Google anatlyics settings on a TrackingSettings object
|
1834 |
+
*
|
1835 |
+
* @param bool|Ganalytics $enable A Ganalytics object or a boolean to
|
1836 |
+
* determine if this setting
|
1837 |
+
* is active
|
1838 |
+
* @param string|null $utm_source Name of the referrer source. (e.g.
|
1839 |
+
* Google, SomeDomain.com, or
|
1840 |
+
* Marketing Email)
|
1841 |
+
* @param string|null $utm_medium Name of the marketing medium.
|
1842 |
+
* (e.g. Email)
|
1843 |
+
* @param string|null $utm_term Used to identify any paid keywords.
|
1844 |
+
* @param string|null $utm_content Used to differentiate your campaign
|
1845 |
+
* from advertisements
|
1846 |
+
* @param string|null $utm_campaign The name of the campaign
|
1847 |
+
*/
|
1848 |
+
public function setGanalytics(
|
1849 |
+
$enable = null,
|
1850 |
+
$utm_source = null,
|
1851 |
+
$utm_medium = null,
|
1852 |
+
$utm_term = null,
|
1853 |
+
$utm_content = null,
|
1854 |
+
$utm_campaign = null
|
1855 |
+
) {
|
1856 |
+
if (!($this->tracking_settings instanceof TrackingSettings)) {
|
1857 |
+
$this->tracking_settings = new TrackingSettings();
|
1858 |
+
}
|
1859 |
+
$this->tracking_settings->setGanalytics(
|
1860 |
+
$enable,
|
1861 |
+
$utm_source,
|
1862 |
+
$utm_medium,
|
1863 |
+
$utm_term,
|
1864 |
+
$utm_content,
|
1865 |
+
$utm_campaign
|
1866 |
+
);
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
/**
|
1870 |
+
* Return an array representing a request object for the Twilio SendGrid API
|
1871 |
+
*
|
1872 |
+
* @return null|array
|
1873 |
+
*/
|
1874 |
+
public function jsonSerialize()
|
1875 |
+
{
|
1876 |
+
// Detect if we are using the new dynamic templates
|
1877 |
+
$template_id = $this->getTemplateId();
|
1878 |
+
if ($template_id != null) {
|
1879 |
+
if (substr((string) $template_id->getTemplateId(), 0, 2) == "d-") {
|
1880 |
+
foreach ($this->personalization as $personalization) {
|
1881 |
+
$personalization->setHasDynamicTemplate(true);
|
1882 |
+
}
|
1883 |
+
}
|
1884 |
+
}
|
1885 |
+
return array_filter(
|
1886 |
+
[
|
1887 |
+
'personalizations' => $this->getPersonalizations(),
|
1888 |
+
'from' => $this->getFrom(),
|
1889 |
+
'reply_to' => $this->getReplyTo(),
|
1890 |
+
'subject' => $this->getGlobalSubject(),
|
1891 |
+
'content' => $this->getContents(),
|
1892 |
+
'attachments' => $this->getAttachments(),
|
1893 |
+
'template_id' => $this->getTemplateId(),
|
1894 |
+
'sections' => $this->getSections(),
|
1895 |
+
'headers' => $this->getGlobalHeaders(),
|
1896 |
+
'categories' => $this->getCategories(),
|
1897 |
+
'custom_args' => $this->getGlobalCustomArgs(),
|
1898 |
+
'send_at' => $this->getGlobalSendAt(),
|
1899 |
+
'batch_id' => $this->getBatchId(),
|
1900 |
+
'asm' => $this->getASM(),
|
1901 |
+
'ip_pool_name' => $this->getIpPoolName(),
|
1902 |
+
'substitutions' => $this->getGlobalSubstitutions(),
|
1903 |
+
'mail_settings' => $this->getMailSettings(),
|
1904 |
+
'tracking_settings' => $this->getTrackingSettings()
|
1905 |
+
],
|
1906 |
+
function ($value) {
|
1907 |
+
return $value !== null;
|
1908 |
+
}
|
1909 |
+
) ?: null;
|
1910 |
+
}
|
1911 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/MailSettings.php
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the MailSettings object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a MailSettings object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* A collection of different mail settings that you can use to specify how you would
|
21 |
+
* like this email to be handled
|
22 |
+
*
|
23 |
+
* @package SendGrid\Mail
|
24 |
+
*/
|
25 |
+
class MailSettings implements \JsonSerializable
|
26 |
+
{
|
27 |
+
/** @var $bcc Bcc object */
|
28 |
+
private $bcc;
|
29 |
+
/** @var $bypass_list_management BypassListManagement object */
|
30 |
+
private $bypass_list_management;
|
31 |
+
/** @var $footer Footer object */
|
32 |
+
private $footer;
|
33 |
+
/** @var $sandbox_mode SandBoxMode object */
|
34 |
+
private $sandbox_mode;
|
35 |
+
/** @var $spam_check SpamCheck object */
|
36 |
+
private $spam_check;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Optional constructor
|
40 |
+
*
|
41 |
+
* @param BccSettings|null $bcc_settings BccSettings object
|
42 |
+
* @param BypassListManagement|null $bypass_list_management BypassListManagement
|
43 |
+
* object
|
44 |
+
* @param Footer|null $footer Footer object
|
45 |
+
* @param SandBoxMode|null $sandbox_mode SandBoxMode object
|
46 |
+
* @param SpamCheck|null $spam_check SpamCheck object
|
47 |
+
*/
|
48 |
+
public function __construct(
|
49 |
+
$bcc_settings = null,
|
50 |
+
$bypass_list_management = null,
|
51 |
+
$footer = null,
|
52 |
+
$sandbox_mode = null,
|
53 |
+
$spam_check = null
|
54 |
+
) {
|
55 |
+
if (isset($bcc_settings)) {
|
56 |
+
$this->setBccSettings($bcc_settings);
|
57 |
+
}
|
58 |
+
if (isset($bypass_list_management)) {
|
59 |
+
$this->setBypassListManagement($bypass_list_management);
|
60 |
+
}
|
61 |
+
if (isset($footer)) {
|
62 |
+
$this->setFooter($footer);
|
63 |
+
}
|
64 |
+
if (isset($sandbox_mode)) {
|
65 |
+
$this->setSandboxMode($sandbox_mode);
|
66 |
+
}
|
67 |
+
if (isset($spam_check)) {
|
68 |
+
$this->setSpamCheck($spam_check);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Set the bcc settings on a MailSettings object
|
74 |
+
*
|
75 |
+
* @param BccSettings|bool $enable The BccSettings object or an indication
|
76 |
+
* if the setting is enabled
|
77 |
+
* @param string|null $email The email address that you would like
|
78 |
+
* to receive the BCC
|
79 |
+
*
|
80 |
+
* @throws TypeException
|
81 |
+
*/
|
82 |
+
public function setBccSettings($enable, $email = null)
|
83 |
+
{
|
84 |
+
if ($enable instanceof BccSettings) {
|
85 |
+
$bcc = $enable;
|
86 |
+
$this->bcc = $bcc;
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
if (!is_bool($enable)) {
|
90 |
+
throw new TypeException(
|
91 |
+
'$enable must be an instance of SendGrid\Mail\BccSettings or of type bool.'
|
92 |
+
);
|
93 |
+
}
|
94 |
+
$this->bcc = new BccSettings($enable, $email);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Retrieve the bcc settings from a MailSettings object
|
99 |
+
*
|
100 |
+
* @return Bcc
|
101 |
+
*/
|
102 |
+
public function getBccSettings()
|
103 |
+
{
|
104 |
+
return $this->bcc;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Set bypass list management settings on a MailSettings object
|
109 |
+
*
|
110 |
+
* @param BypassListManagement|bool $enable The BypassListManagement
|
111 |
+
* object or an indication
|
112 |
+
* if the setting is enabled
|
113 |
+
*
|
114 |
+
* @throws TypeException
|
115 |
+
*/
|
116 |
+
public function setBypassListManagement($enable)
|
117 |
+
{
|
118 |
+
if ($enable instanceof BypassListManagement) {
|
119 |
+
$bypass_list_management = $enable;
|
120 |
+
$this->bypass_list_management = $bypass_list_management;
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
if (!is_bool($enable)) {
|
124 |
+
throw new TypeException(
|
125 |
+
'$enable must be an instance of SendGrid\Mail\BypassListManagement or of type bool.'
|
126 |
+
);
|
127 |
+
}
|
128 |
+
$this->bypass_list_management = new BypassListManagement($enable);
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Retrieve bypass list management settings from a MailSettings object
|
134 |
+
*
|
135 |
+
* @return BypassListManagement
|
136 |
+
*/
|
137 |
+
public function getBypassListManagement()
|
138 |
+
{
|
139 |
+
return $this->bypass_list_management;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Set the footer settings on a MailSettings object
|
144 |
+
*
|
145 |
+
* @param Footer|bool $enable The Footer object or an indication
|
146 |
+
* if the setting is enabled
|
147 |
+
* @param string|null $text The plain text content of your footer
|
148 |
+
* @param string|null $html The HTML content of your footer
|
149 |
+
*
|
150 |
+
* @return null
|
151 |
+
*/
|
152 |
+
public function setFooter($enable, $text = null, $html = null)
|
153 |
+
{
|
154 |
+
if ($enable instanceof Footer) {
|
155 |
+
$footer = $enable;
|
156 |
+
$this->footer = $footer;
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
$this->footer = new Footer($enable, $text, $html);
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Retrieve the footer settings from a MailSettings object
|
165 |
+
*
|
166 |
+
* @return Footer
|
167 |
+
*/
|
168 |
+
public function getFooter()
|
169 |
+
{
|
170 |
+
return $this->footer;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Set sandbox mode settings on a MailSettings object
|
175 |
+
*
|
176 |
+
* @param SandBoxMode|bool $enable The SandBoxMode object or an
|
177 |
+
* indication if the setting is enabled
|
178 |
+
*
|
179 |
+
* @return null
|
180 |
+
*/
|
181 |
+
public function setSandboxMode($enable)
|
182 |
+
{
|
183 |
+
if ($enable instanceof SandBoxMode) {
|
184 |
+
$sandbox_mode = $enable;
|
185 |
+
$this->sandbox_mode = $sandbox_mode;
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
$this->sandbox_mode = new SandBoxMode($enable);
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Retrieve sandbox mode settings on a MailSettings object
|
194 |
+
*
|
195 |
+
* @return SandBoxMode
|
196 |
+
*/
|
197 |
+
public function getSandboxMode()
|
198 |
+
{
|
199 |
+
return $this->sandbox_mode;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Enable sandbox mode on a MailSettings object
|
204 |
+
*/
|
205 |
+
public function enableSandboxMode()
|
206 |
+
{
|
207 |
+
$this->setSandboxMode(true);
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Disable sandbox mode on a MailSettings object
|
212 |
+
*/
|
213 |
+
public function disableSandboxMode()
|
214 |
+
{
|
215 |
+
$this->setSandboxMode(false);
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Set spam check settings on a MailSettings object
|
220 |
+
*
|
221 |
+
* @param SpamCheck|bool $enable The SpamCheck object or an
|
222 |
+
* indication if the setting is enabled
|
223 |
+
* @param int $threshold The threshold used to determine if your
|
224 |
+
* content qualifies as spam on a scale
|
225 |
+
* from 1 to 10, with 10 being most strict,
|
226 |
+
* or most
|
227 |
+
* @param string $post_to_url An Inbound Parse URL that you would like
|
228 |
+
* a copy of your email along with the spam
|
229 |
+
* report to be sent to
|
230 |
+
*
|
231 |
+
* @return null
|
232 |
+
*/
|
233 |
+
public function setSpamCheck($enable, $threshold = null, $post_to_url = null)
|
234 |
+
{
|
235 |
+
if ($enable instanceof SpamCheck) {
|
236 |
+
$spam_check = $enable;
|
237 |
+
$this->spam_check = $spam_check;
|
238 |
+
return;
|
239 |
+
}
|
240 |
+
$this->spam_check = new SpamCheck($enable, $threshold, $post_to_url);
|
241 |
+
return;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Retrieve spam check settings from a MailSettings object
|
246 |
+
*
|
247 |
+
* @return SpamCheck
|
248 |
+
*/
|
249 |
+
public function getSpamCheck()
|
250 |
+
{
|
251 |
+
return $this->spam_check;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Return an array representing a MailSettings object for the Twilio SendGrid API
|
256 |
+
*
|
257 |
+
* @return null|array
|
258 |
+
*/
|
259 |
+
public function jsonSerialize()
|
260 |
+
{
|
261 |
+
return array_filter(
|
262 |
+
[
|
263 |
+
'bcc' => $this->getBccSettings(),
|
264 |
+
'bypass_list_management' => $this->getBypassListManagement(),
|
265 |
+
'footer' => $this->getFooter(),
|
266 |
+
'sandbox_mode' => $this->getSandboxMode(),
|
267 |
+
'spam_check' => $this->getSpamCheck()
|
268 |
+
],
|
269 |
+
function ($value) {
|
270 |
+
return $value !== null;
|
271 |
+
}
|
272 |
+
) ?: null;
|
273 |
+
}
|
274 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/MimeType.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper defines the content mime types for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to define the content mime types for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
abstract class MimeType
|
23 |
+
{
|
24 |
+
const HTML = "text/html";
|
25 |
+
const TEXT = "text/plain";
|
26 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/OpenTracking.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the OpenTracking object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a OpenTracking object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* Allows you to track whether the email was opened or not, but including a single
|
21 |
+
* pixel image in the body of the content. When the pixel is loaded, we can log that
|
22 |
+
* the email was opened
|
23 |
+
*
|
24 |
+
* @package SendGrid\Mail
|
25 |
+
*/
|
26 |
+
class OpenTracking implements \JsonSerializable
|
27 |
+
{
|
28 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
29 |
+
private $enable;
|
30 |
+
/** @var $substitution_tag string Allows you to specify a substitution tag that you can insert in the body of your email at a location that you desire. This tag will be replaced by the open tracking pixel */
|
31 |
+
private $substitution_tag;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Optional constructor
|
35 |
+
*
|
36 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
37 |
+
* @param string|null $substitution_tag Allows you to specify a substitution
|
38 |
+
* tag that you can insert in the body
|
39 |
+
* of your email at a location that you
|
40 |
+
* desire. This tag will be replaced by
|
41 |
+
* the open tracking pixel
|
42 |
+
*/
|
43 |
+
public function __construct($enable = null, $substitution_tag = null)
|
44 |
+
{
|
45 |
+
if (isset($enable)) {
|
46 |
+
$this->setEnable($enable);
|
47 |
+
}
|
48 |
+
if (isset($substitution_tag)) {
|
49 |
+
$this->setSubstitutionTag($substitution_tag);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Update the enable setting on a OpenTracking object
|
55 |
+
*
|
56 |
+
* @param bool $enable Indicates if this setting is enabled
|
57 |
+
*
|
58 |
+
* @throws TypeException
|
59 |
+
*/
|
60 |
+
public function setEnable($enable)
|
61 |
+
{
|
62 |
+
if (!is_bool($enable)) {
|
63 |
+
throw new TypeException('$enable must be of type bool');
|
64 |
+
}
|
65 |
+
$this->enable = $enable;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Retrieve the enable setting on a OpenTracking object
|
70 |
+
*
|
71 |
+
* @return bool
|
72 |
+
*/
|
73 |
+
public function getEnable()
|
74 |
+
{
|
75 |
+
return $this->enable;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Set the substitution tag on a OpenTracking object
|
80 |
+
*
|
81 |
+
* @param string $substitution_tag Allows you to specify a substitution
|
82 |
+
* tag that you can insert in the body
|
83 |
+
* of your email at a location that you
|
84 |
+
* desire. This tag will be replaced by
|
85 |
+
* the open tracking pixel
|
86 |
+
*
|
87 |
+
* @throws TypeException
|
88 |
+
*/
|
89 |
+
public function setSubstitutionTag($substitution_tag)
|
90 |
+
{
|
91 |
+
if (!is_string($substitution_tag)) {
|
92 |
+
throw new TypeException('$substitution_tag must be of type string.');
|
93 |
+
}
|
94 |
+
$this->substitution_tag = $substitution_tag;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Retrieve the substitution tag from a OpenTracking object
|
99 |
+
*
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
public function getSubstitutionTag()
|
103 |
+
{
|
104 |
+
return $this->substitution_tag;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Return an array representing a OpenTracking object for the Twilio SendGrid API
|
109 |
+
*
|
110 |
+
* @return null|array
|
111 |
+
*/
|
112 |
+
public function jsonSerialize()
|
113 |
+
{
|
114 |
+
return array_filter(
|
115 |
+
[
|
116 |
+
'enable' => $this->getEnable(),
|
117 |
+
'substitution_tag' => $this->getSubstitutionTag()
|
118 |
+
],
|
119 |
+
function ($value) {
|
120 |
+
return $value !== null;
|
121 |
+
}
|
122 |
+
) ?: null;
|
123 |
+
}
|
124 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Personalization.php
ADDED
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Personalization object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Personalization object for
|
19 |
+
* the /mail/send API call
|
20 |
+
*
|
21 |
+
* Each Personalization can be thought of as an envelope - it defines
|
22 |
+
* who should receive an individual message and how that message should be handled
|
23 |
+
*
|
24 |
+
* @package SendGrid\Mail
|
25 |
+
*/
|
26 |
+
class Personalization implements \JsonSerializable
|
27 |
+
{
|
28 |
+
/** @var $tos To[] objects */
|
29 |
+
private $tos;
|
30 |
+
/** @var $ccs Cc[] objects */
|
31 |
+
private $ccs;
|
32 |
+
/** @var $bccs Bcc[] objects */
|
33 |
+
private $bccs;
|
34 |
+
/** @var $subject Subject object */
|
35 |
+
private $subject;
|
36 |
+
/** @var $headers Header[] array of header key values */
|
37 |
+
private $headers;
|
38 |
+
/** @var $substitutions Substitution[] array of substitution key values, used for legacy templates */
|
39 |
+
private $substitutions;
|
40 |
+
/** @var array of dynamic template data key values */
|
41 |
+
private $dynamic_template_data;
|
42 |
+
/** @var bool if we are using dynamic templates this will be true */
|
43 |
+
private $has_dynamic_template = false;
|
44 |
+
/** @var $custom_args CustomArg[] array of custom arg key values */
|
45 |
+
private $custom_args;
|
46 |
+
/** @var $send_at SendAt object */
|
47 |
+
private $send_at;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Add a To object to a Personalization object
|
51 |
+
*
|
52 |
+
* @param To $email To object
|
53 |
+
*/
|
54 |
+
public function addTo($email)
|
55 |
+
{
|
56 |
+
$this->tos[] = $email;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Retrieve To object(s) from a Personalization object
|
61 |
+
*
|
62 |
+
* @return To[]
|
63 |
+
*/
|
64 |
+
public function getTos()
|
65 |
+
{
|
66 |
+
return $this->tos;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Add a Cc object to a Personalization object
|
71 |
+
*
|
72 |
+
* @param Cc $email Cc object
|
73 |
+
*/
|
74 |
+
public function addCc($email)
|
75 |
+
{
|
76 |
+
$this->ccs[] = $email;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Retrieve Cc object(s) from a Personalization object
|
81 |
+
*
|
82 |
+
* @return Cc[]
|
83 |
+
*/
|
84 |
+
public function getCcs()
|
85 |
+
{
|
86 |
+
return $this->ccs;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Add a Bcc object to a Personalization object
|
91 |
+
*
|
92 |
+
* @param Bcc $email Bcc object
|
93 |
+
*/
|
94 |
+
public function addBcc($email)
|
95 |
+
{
|
96 |
+
$this->bccs[] = $email;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Retrieve Bcc object(s) from a Personalization object
|
101 |
+
*
|
102 |
+
* @return Bcc[]
|
103 |
+
*/
|
104 |
+
public function getBccs()
|
105 |
+
{
|
106 |
+
return $this->bccs;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Add a subject object to a Personalization object
|
111 |
+
*
|
112 |
+
* @param Subject $subject Subject object
|
113 |
+
*
|
114 |
+
* @throws TypeException
|
115 |
+
*/
|
116 |
+
public function setSubject($subject)
|
117 |
+
{
|
118 |
+
if (!($subject instanceof Subject)) {
|
119 |
+
throw new TypeException(
|
120 |
+
'$subject must be an instance of SendGrid\Mail\Subject'
|
121 |
+
);
|
122 |
+
}
|
123 |
+
$this->subject = $subject;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Retrieve a Subject object from a Personalization object
|
128 |
+
*
|
129 |
+
* @return Subject
|
130 |
+
*/
|
131 |
+
public function getSubject()
|
132 |
+
{
|
133 |
+
return $this->subject;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Add a Header object to a Personalization object
|
138 |
+
*
|
139 |
+
* @param Header $header Header object
|
140 |
+
*/
|
141 |
+
public function addHeader($header)
|
142 |
+
{
|
143 |
+
$this->headers[$header->getKey()] = $header->getValue();
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Retrieve header key/value pairs from a Personalization object
|
148 |
+
*
|
149 |
+
* @return array
|
150 |
+
*/
|
151 |
+
public function getHeaders()
|
152 |
+
{
|
153 |
+
return $this->headers;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Add a Substitution object or key/value to a Personalization object
|
158 |
+
*
|
159 |
+
* @param Substitution|string $data DynamicTemplateData object or the key of a
|
160 |
+
* dynamic data
|
161 |
+
* @param string|null $value The value of dynmic data
|
162 |
+
*
|
163 |
+
* @return null
|
164 |
+
*/
|
165 |
+
public function addDynamicTemplateData($data, $value = null)
|
166 |
+
{
|
167 |
+
$this->addSubstitution($data, $value);
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Retrieve dynamic template data key/value pairs from a Personalization object
|
172 |
+
*
|
173 |
+
* @return array
|
174 |
+
*/
|
175 |
+
public function getDynamicTemplateData()
|
176 |
+
{
|
177 |
+
return $this->getSubstitutions();
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Add a Substitution object or key/value to a Personalization object
|
182 |
+
*
|
183 |
+
* @param Substitution|string $substitution Substitution object or the key of a
|
184 |
+
* substitution
|
185 |
+
* @param string|null $value The value of a substitution
|
186 |
+
*/
|
187 |
+
public function addSubstitution($substitution, $value = null)
|
188 |
+
{
|
189 |
+
if (!($substitution instanceof Substitution)) {
|
190 |
+
$key = $substitution;
|
191 |
+
$substitution = new Substitution($key, $value);
|
192 |
+
}
|
193 |
+
$this->substitutions[$substitution->getKey()] = $substitution->getValue();
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Retrieve substitution key/value pairs from a Personalization object
|
198 |
+
*
|
199 |
+
* @return array
|
200 |
+
*/
|
201 |
+
public function getSubstitutions()
|
202 |
+
{
|
203 |
+
return $this->substitutions;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Add a CustomArg object to a Personalization object
|
208 |
+
*
|
209 |
+
* @param CustomArg $custom_arg CustomArg object
|
210 |
+
*/
|
211 |
+
public function addCustomArg($custom_arg)
|
212 |
+
{
|
213 |
+
$this->custom_args[$custom_arg->getKey()] = (string)$custom_arg->getValue();
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Retrieve custom arg key/value pairs from a Personalization object
|
218 |
+
*
|
219 |
+
* @return array
|
220 |
+
*/
|
221 |
+
public function getCustomArgs()
|
222 |
+
{
|
223 |
+
return $this->custom_args;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Add a SendAt object to a Personalization object
|
228 |
+
*
|
229 |
+
* @param SendAt $send_at SendAt object
|
230 |
+
*
|
231 |
+
* @throws TypeException
|
232 |
+
*/
|
233 |
+
public function setSendAt($send_at)
|
234 |
+
{
|
235 |
+
if (!($send_at instanceof SendAt)) {
|
236 |
+
throw new TypeException(
|
237 |
+
'$send_at must be an instance of SendGrid\Mail\SendAt'
|
238 |
+
);
|
239 |
+
}
|
240 |
+
$this->send_at = $send_at;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Retrieve a SendAt object from a Personalization object
|
245 |
+
*
|
246 |
+
* @return SendAt
|
247 |
+
*/
|
248 |
+
public function getSendAt()
|
249 |
+
{
|
250 |
+
return $this->send_at;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Specify if this personalization is using dynamic templates
|
255 |
+
*
|
256 |
+
* @param bool $has_dynamic_template are we using dynamic templates
|
257 |
+
*
|
258 |
+
* @throws TypeException
|
259 |
+
*/
|
260 |
+
public function setHasDynamicTemplate($has_dynamic_template)
|
261 |
+
{
|
262 |
+
if (is_bool($has_dynamic_template) != true) {
|
263 |
+
throw new TypeException(
|
264 |
+
'$has_dynamic_template must be an instance of bool'
|
265 |
+
);
|
266 |
+
}
|
267 |
+
$this->has_dynamic_template = $has_dynamic_template;
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Determine if this Personalization object is using dynamic templates
|
272 |
+
*
|
273 |
+
* @return bool
|
274 |
+
*/
|
275 |
+
public function getHasDynamicTemplate()
|
276 |
+
{
|
277 |
+
return $this->has_dynamic_template;
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Return an array representing a Personalization object for the Twilio SendGrid API
|
282 |
+
*
|
283 |
+
* @return null|array
|
284 |
+
*/
|
285 |
+
public function jsonSerialize()
|
286 |
+
{
|
287 |
+
if ($this->getHasDynamicTemplate() == true) {
|
288 |
+
$dynamic_substitutions = $this->getSubstitutions();
|
289 |
+
$substitutions = null;
|
290 |
+
} else {
|
291 |
+
$substitutions = $this->getSubstitutions();
|
292 |
+
$dynamic_substitutions = null;
|
293 |
+
}
|
294 |
+
|
295 |
+
return array_filter(
|
296 |
+
[
|
297 |
+
'to' => $this->getTos(),
|
298 |
+
'cc' => $this->getCcs(),
|
299 |
+
'bcc' => $this->getBccs(),
|
300 |
+
'subject' => $this->getSubject(),
|
301 |
+
'headers' => $this->getHeaders(),
|
302 |
+
'substitutions' => $substitutions,
|
303 |
+
'dynamic_template_data' => $dynamic_substitutions,
|
304 |
+
'custom_args' => $this->getCustomArgs(),
|
305 |
+
'send_at' => $this->getSendAt()
|
306 |
+
],
|
307 |
+
function ($value) {
|
308 |
+
return $value !== null;
|
309 |
+
}
|
310 |
+
) ?: null;
|
311 |
+
}
|
312 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/PlainTextContent.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds theContent object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Content object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class PlainTextContent extends Content
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Create a Content object with a plain text mime type
|
26 |
+
*
|
27 |
+
* @param string $value plain text formatted content
|
28 |
+
*/
|
29 |
+
public function __construct($value)
|
30 |
+
{
|
31 |
+
parent::__construct(MimeType::TEXT, $value);
|
32 |
+
}
|
33 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
**This helper allows you to quickly and easily build a Mail object for sending email through Twilio SendGrid.**
|
2 |
+
|
3 |
+
# Quick Start
|
4 |
+
|
5 |
+
Run the [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
|
6 |
+
|
7 |
+
```bash
|
8 |
+
php examples/helpers/mail/example.php
|
9 |
+
```
|
10 |
+
|
11 |
+
## Usage
|
12 |
+
|
13 |
+
- See this complete working [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php).
|
14 |
+
- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/overview.html)
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/ReplyTo.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the ReplyTo object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a ReplyTo object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class ReplyTo extends EmailAddress implements \JsonSerializable
|
23 |
+
{
|
24 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SandBoxMode.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the SandBoxMode object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a SandBoxMode object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class SandBoxMode implements \JsonSerializable
|
23 |
+
{
|
24 |
+
// @var bool Indicates if this setting is enabled
|
25 |
+
private $enable;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Optional constructor
|
29 |
+
*
|
30 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
31 |
+
*/
|
32 |
+
public function __construct($enable = null)
|
33 |
+
{
|
34 |
+
if (isset($enable)) {
|
35 |
+
$this->setEnable($enable);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Update the enable setting on a SandBoxMode object
|
41 |
+
*
|
42 |
+
* @param bool $enable Indicates if this setting is enabled
|
43 |
+
*
|
44 |
+
* @throws TypeException
|
45 |
+
*/
|
46 |
+
public function setEnable($enable)
|
47 |
+
{
|
48 |
+
if (!is_bool($enable)) {
|
49 |
+
throw new TypeException('$enable must be of type bool.');
|
50 |
+
}
|
51 |
+
$this->enable = $enable;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve the enable setting on a SandBoxMode object
|
56 |
+
*
|
57 |
+
* @return bool
|
58 |
+
*/
|
59 |
+
public function getEnable()
|
60 |
+
{
|
61 |
+
return $this->enable;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Return an array representing a SandBoxMode object for the Twilio SendGrid API
|
66 |
+
*
|
67 |
+
* @return null|array
|
68 |
+
*/
|
69 |
+
public function jsonSerialize()
|
70 |
+
{
|
71 |
+
return array_filter(
|
72 |
+
[
|
73 |
+
'enable' => $this->getEnable()
|
74 |
+
],
|
75 |
+
function ($value) {
|
76 |
+
return $value !== null;
|
77 |
+
}
|
78 |
+
) ?: null;
|
79 |
+
}
|
80 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Section.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Section object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Section object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* An object of key/value pairs that define block sections of code to be used
|
21 |
+
* as substitutions
|
22 |
+
*
|
23 |
+
* @package SendGrid\Mail
|
24 |
+
*/
|
25 |
+
class Section implements \JsonSerializable
|
26 |
+
{
|
27 |
+
/** @var $key string Section key */
|
28 |
+
private $key;
|
29 |
+
/** @var $value string Section value */
|
30 |
+
private $value;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Optional constructor
|
34 |
+
*
|
35 |
+
* @param string|null $key Section key
|
36 |
+
* @param string|null $value Section value
|
37 |
+
*/
|
38 |
+
public function __construct($key = null, $value = null)
|
39 |
+
{
|
40 |
+
if (isset($key)) {
|
41 |
+
$this->setKey($key);
|
42 |
+
}
|
43 |
+
if (isset($value)) {
|
44 |
+
$this->setValue($value);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Add the key on a Section object
|
50 |
+
*
|
51 |
+
* @param string $key Section key
|
52 |
+
*
|
53 |
+
* @throws TypeException
|
54 |
+
*/
|
55 |
+
public function setKey($key)
|
56 |
+
{
|
57 |
+
if (!is_string($key)) {
|
58 |
+
throw new TypeException('$key must be of type string.');
|
59 |
+
}
|
60 |
+
$this->key = $key;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Retrieve the key from a Section object
|
65 |
+
*
|
66 |
+
* @return string
|
67 |
+
*/
|
68 |
+
public function getKey()
|
69 |
+
{
|
70 |
+
return $this->key;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Add the value on a Section object
|
75 |
+
*
|
76 |
+
* @param string $value Section value
|
77 |
+
*
|
78 |
+
* @throws TypeException
|
79 |
+
*/
|
80 |
+
public function setValue($value)
|
81 |
+
{
|
82 |
+
if (!is_string($value)) {
|
83 |
+
throw new TypeException('$value must be of type string.');
|
84 |
+
}
|
85 |
+
$this->value = $value;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Retrieve the value from a Section object
|
90 |
+
*
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
public function getValue()
|
94 |
+
{
|
95 |
+
return $this->value;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Return an array representing a Section object for the Twilio SendGrid API
|
100 |
+
*
|
101 |
+
* @return null|array
|
102 |
+
*/
|
103 |
+
public function jsonSerialize()
|
104 |
+
{
|
105 |
+
return array_filter(
|
106 |
+
[
|
107 |
+
'key' => $this->getKey(),
|
108 |
+
'value' => $this->getValue()
|
109 |
+
],
|
110 |
+
function ($value) {
|
111 |
+
return $value !== null;
|
112 |
+
}
|
113 |
+
) ?: null;
|
114 |
+
}
|
115 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SendAt.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the SendAt object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
namespace SendGrid\Mail;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* This class is used to construct a SendAt object for the /mail/send API call
|
18 |
+
*
|
19 |
+
* @package SendGrid\Mail
|
20 |
+
*/
|
21 |
+
class SendAt implements \JsonSerializable
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* @var $send_at int A unix timestamp allowing you to specify when you want your email
|
25 |
+
* to be delivered. This may be overridden by the personalizations[x].send_at
|
26 |
+
* parameter. You can't schedule more than 72 hours in advance. If you have
|
27 |
+
* the flexibility, it's better to schedule mail for off-peak times. Most
|
28 |
+
* emails are scheduled and sent at the top of the hour or half hour.
|
29 |
+
* Scheduling email to avoid those times (for example, scheduling at 10:53) can
|
30 |
+
* result in lower deferral rates because it won't be going through our servers
|
31 |
+
* at the same times as everyone else's mail
|
32 |
+
*/
|
33 |
+
|
34 |
+
private $send_at;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Optional constructor
|
38 |
+
*
|
39 |
+
* @param int|null $send_at A unix timestamp allowing you to specify when you
|
40 |
+
* want your email to be delivered. This may be
|
41 |
+
* overridden by the personalizations[x].send_at
|
42 |
+
* parameter. You can't schedule more than 72 hours
|
43 |
+
* in advance. If you have the flexibility, it's better
|
44 |
+
* to schedule mail for off-peak times. Most emails are
|
45 |
+
* scheduled and sent at the top of the hour or half
|
46 |
+
* hour. Scheduling email to avoid those times (for
|
47 |
+
* example, scheduling at 10:53) can result in lower
|
48 |
+
* deferral rates because it won't be going through
|
49 |
+
* our servers at the same times as everyone else's mail
|
50 |
+
*/
|
51 |
+
public function __construct($send_at=null)
|
52 |
+
{
|
53 |
+
if (isset($send_at)) {
|
54 |
+
$this->setSendAt($send_at);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Add the send at value to a SendAt object
|
60 |
+
*
|
61 |
+
* @param int $send_at A unix timestamp allowing you to specify when you
|
62 |
+
* want your email to be delivered. This may be
|
63 |
+
* overridden by the personalizations[x].send_at
|
64 |
+
* parameter. You can't schedule more than 72 hours
|
65 |
+
* in advance. If you have the flexibility, it's better
|
66 |
+
* to schedule mail for off-peak times. Most emails are
|
67 |
+
* scheduled and sent at the top of the hour or half
|
68 |
+
* hour. Scheduling email to avoid those times (for
|
69 |
+
* example, scheduling at 10:53) can result in lower
|
70 |
+
* deferral rates because it won't be going through
|
71 |
+
* our servers at the same times as everyone else's mail
|
72 |
+
*
|
73 |
+
* @throws TypeException
|
74 |
+
*/
|
75 |
+
public function setSendAt($send_at)
|
76 |
+
{
|
77 |
+
if (!is_int($send_at)) {
|
78 |
+
throw new TypeException('$send_at must be of type int.');
|
79 |
+
}
|
80 |
+
$this->send_at = $send_at;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Retrieve the send at value from a SendAt object
|
85 |
+
*
|
86 |
+
* @return int
|
87 |
+
*/
|
88 |
+
public function getSendAt()
|
89 |
+
{
|
90 |
+
return $this->send_at;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Return an array representing a SendAt object for the Twilio SendGrid API
|
95 |
+
*
|
96 |
+
* @return int
|
97 |
+
*/
|
98 |
+
public function jsonSerialize()
|
99 |
+
{
|
100 |
+
return $this->getSendAt();
|
101 |
+
}
|
102 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SpamCheck.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the SpamCheck object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a SpamCheck object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class SpamCheck implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
25 |
+
private $enable;
|
26 |
+
/**
|
27 |
+
* @var $threshold int The threshold used to determine if your content qualifies as
|
28 |
+
* spam on a scale from 1 to 10, with 10 being most strict, or most
|
29 |
+
* likely to be considered as spam
|
30 |
+
*/
|
31 |
+
private $threshold;
|
32 |
+
/**
|
33 |
+
* @var $post_to_urlstring An Inbound Parse URL that you would like a copy of your
|
34 |
+
* email along with the spam report to be sent to
|
35 |
+
*/
|
36 |
+
private $post_to_url;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Optional constructor
|
40 |
+
*
|
41 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
42 |
+
* @param int|null $threshold The threshold used to determine if your
|
43 |
+
* content qualifies as spam on a scale
|
44 |
+
* from 1 to 10, with 10 being most strict,
|
45 |
+
* or most
|
46 |
+
* @param string|null $post_to_url An Inbound Parse URL that you would like
|
47 |
+
* a copy of your email along with the spam
|
48 |
+
* report to be sent to
|
49 |
+
*/
|
50 |
+
public function __construct($enable = null, $threshold = null, $post_to_url = null)
|
51 |
+
{
|
52 |
+
if (isset($enable)) {
|
53 |
+
$this->setEnable($enable);
|
54 |
+
}
|
55 |
+
if (isset($threshold)) {
|
56 |
+
$this->setThreshold($threshold);
|
57 |
+
}
|
58 |
+
if (isset($post_to_url)) {
|
59 |
+
$this->setPostToUrl($post_to_url);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Update the enable setting on a SpamCheck object
|
65 |
+
*
|
66 |
+
* @param bool $enable Indicates if this setting is enabled
|
67 |
+
*
|
68 |
+
* @throws TypeException
|
69 |
+
*/
|
70 |
+
public function setEnable($enable)
|
71 |
+
{
|
72 |
+
if (!is_bool($enable)) {
|
73 |
+
throw new TypeException('$enable must be of type bool.');
|
74 |
+
}
|
75 |
+
$this->enable = $enable;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Retrieve the enable setting on a SpamCheck object
|
80 |
+
*
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
public function getEnable()
|
84 |
+
{
|
85 |
+
return $this->enable;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Set the threshold value on a SpamCheck object
|
90 |
+
*
|
91 |
+
* @param int $threshold The threshold used to determine if your
|
92 |
+
* content qualifies as spam on a scale
|
93 |
+
* from 1 to 10, with 10 being most strict,
|
94 |
+
* or most
|
95 |
+
*
|
96 |
+
* @throws TypeException
|
97 |
+
*/
|
98 |
+
public function setThreshold($threshold)
|
99 |
+
{
|
100 |
+
if (!is_int($threshold)) {
|
101 |
+
throw new TypeException('$threshold must be of type int.');
|
102 |
+
}
|
103 |
+
$this->threshold = $threshold;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Retrieve the threshold value from a SpamCheck object
|
108 |
+
*
|
109 |
+
* @return int
|
110 |
+
*/
|
111 |
+
public function getThreshold()
|
112 |
+
{
|
113 |
+
return $this->threshold;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Set the post to url value on a SpamCheck object
|
118 |
+
*
|
119 |
+
* @param string $post_to_url An Inbound Parse URL that you would like
|
120 |
+
* a copy of your email along with the spam
|
121 |
+
* report to be sent to
|
122 |
+
*
|
123 |
+
* @throws TypeException
|
124 |
+
*/
|
125 |
+
public function setPostToUrl($post_to_url)
|
126 |
+
{
|
127 |
+
if (!is_string($post_to_url)) {
|
128 |
+
throw new TypeException('$post_to_url must be of type string.');
|
129 |
+
}
|
130 |
+
$this->post_to_url = $post_to_url;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Retrieve the post to url value from a SpamCheck object
|
135 |
+
*
|
136 |
+
* @return string
|
137 |
+
*/
|
138 |
+
public function getPostToUrl()
|
139 |
+
{
|
140 |
+
return $this->post_to_url;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Return an array representing a SpamCheck object for the Twilio SendGrid API
|
145 |
+
*
|
146 |
+
* @return null|array
|
147 |
+
*/
|
148 |
+
public function jsonSerialize()
|
149 |
+
{
|
150 |
+
return array_filter(
|
151 |
+
[
|
152 |
+
'enable' => $this->getEnable(),
|
153 |
+
'threshold' => $this->getThreshold(),
|
154 |
+
'post_to_url' => $this->getPostToUrl()
|
155 |
+
],
|
156 |
+
function ($value) {
|
157 |
+
return $value !== null;
|
158 |
+
}
|
159 |
+
) ?: null;
|
160 |
+
}
|
161 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Subject.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Subject object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Subject object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class Subject implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/** @var $subject string The email subject */
|
25 |
+
private $subject;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Optional constructor
|
29 |
+
*
|
30 |
+
* @param string|null $subject The email subject
|
31 |
+
*/
|
32 |
+
public function __construct($subject = null)
|
33 |
+
{
|
34 |
+
if (isset($subject)) {
|
35 |
+
$this->setSubject($subject);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Set the subject on a Subject object
|
41 |
+
*
|
42 |
+
* @param string $subject The email subject
|
43 |
+
*
|
44 |
+
* @throws TypeException
|
45 |
+
*/
|
46 |
+
public function setSubject($subject)
|
47 |
+
{
|
48 |
+
if (!is_string($subject)) {
|
49 |
+
throw new TypeException('$subject must be of type string.');
|
50 |
+
}
|
51 |
+
|
52 |
+
$this->subject = $subject;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Retrieve the subject from a Subject object
|
57 |
+
*
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function getSubject()
|
61 |
+
{
|
62 |
+
return mb_convert_encoding($this->subject, 'UTF-8', 'UTF-8');
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Return an array representing a Subject object for the Twilio SendGrid API
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
public function jsonSerialize()
|
71 |
+
{
|
72 |
+
return $this->getSubject();
|
73 |
+
}
|
74 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/SubscriptionTracking.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the SubscriptionTracking object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a SubscriptionTracking object for
|
19 |
+
* the /mail/send API call
|
20 |
+
*
|
21 |
+
* Allows you to insert a subscription management link at the bottom
|
22 |
+
* of the text and html bodies of your email. If you would like to
|
23 |
+
* specify the location of the link within your email, you may use
|
24 |
+
* the substitution_tag
|
25 |
+
*
|
26 |
+
* @package SendGrid\Mail
|
27 |
+
*/
|
28 |
+
class SubscriptionTracking implements \JsonSerializable
|
29 |
+
{
|
30 |
+
/** @var $enable bool Indicates if this setting is enabled */
|
31 |
+
private $enable;
|
32 |
+
/**
|
33 |
+
* @var $text string Text to be appended to the email, with the
|
34 |
+
* subscription tracking link. You may control where the
|
35 |
+
* link is by using the tag <% %>
|
36 |
+
*/
|
37 |
+
private $text;
|
38 |
+
/**
|
39 |
+
* @var $htmlstring string to be appended to the email, with the
|
40 |
+
* subscription tracking link. You may control where the
|
41 |
+
* link is by using the tag <% %>
|
42 |
+
*/
|
43 |
+
private $html;
|
44 |
+
/**
|
45 |
+
* @var $substitution_tag string A tag that will be replaced with the
|
46 |
+
* unsubscribe URL. for example: [unsubscribe_url]. If
|
47 |
+
* this parameter is used, it will override both the text
|
48 |
+
* and html parameters. The URL of the link will be placed
|
49 |
+
* at the substitution tag’s location, with no additional
|
50 |
+
* formatting
|
51 |
+
*/
|
52 |
+
private $substitution_tag;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Optional constructor
|
56 |
+
*
|
57 |
+
* @param bool|null $enable Indicates if this setting is enabled
|
58 |
+
* @param string|null $text Text to be appended to the email, with
|
59 |
+
* the subscription tracking link. You may
|
60 |
+
* control where the link is by using the
|
61 |
+
* tag <% %>
|
62 |
+
* @param string|null $html HTML to be appended to the email, with
|
63 |
+
* the subscription tracking link. You may
|
64 |
+
* control where the link is by using the
|
65 |
+
* tag <% %>
|
66 |
+
* @param string|null $substitution_tag A tag that will be replaced with the
|
67 |
+
* unsubscribe URL. For example:
|
68 |
+
* [unsubscribe_url]. If this parameter
|
69 |
+
* is used, it will override both the text
|
70 |
+
* and html parameters. The URL of the link
|
71 |
+
* will be placed at the substitution tag’s
|
72 |
+
* location, with no additional formatting
|
73 |
+
*/
|
74 |
+
public function __construct(
|
75 |
+
$enable = null,
|
76 |
+
$text = null,
|
77 |
+
$html = null,
|
78 |
+
$substitution_tag = null
|
79 |
+
) {
|
80 |
+
if (isset($enable)) {
|
81 |
+
$this->setEnable($enable);
|
82 |
+
}
|
83 |
+
if (isset($text)) {
|
84 |
+
$this->setText($text);
|
85 |
+
}
|
86 |
+
if (isset($html)) {
|
87 |
+
$this->setHtml($html);
|
88 |
+
}
|
89 |
+
if (isset($substitution_tag)) {
|
90 |
+
$this->setSubstitutionTag($substitution_tag);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Update the enable setting on a SubscriptionTracking object
|
96 |
+
*
|
97 |
+
* @param bool $enable Indicates if this setting is enabled
|
98 |
+
*
|
99 |
+
* @throws TypeException
|
100 |
+
*/
|
101 |
+
public function setEnable($enable)
|
102 |
+
{
|
103 |
+
if (!is_bool($enable)) {
|
104 |
+
throw new TypeException('$enable must be of type bool.');
|
105 |
+
}
|
106 |
+
$this->enable = $enable;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Retrieve the enable setting from a SubscriptionTracking object
|
111 |
+
*
|
112 |
+
* @return bool
|
113 |
+
*/
|
114 |
+
public function getEnable()
|
115 |
+
{
|
116 |
+
return $this->enable;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Add text to a SubscriptionTracking object
|
121 |
+
*
|
122 |
+
* @param string $text Text to be appended to the email, with
|
123 |
+
* the subscription tracking link. You may
|
124 |
+
* control where the link is by using the
|
125 |
+
* tag <% %>
|
126 |
+
*
|
127 |
+
* @throws TypeException
|
128 |
+
*/
|
129 |
+
public function setText($text)
|
130 |
+
{
|
131 |
+
if (!is_string($text)) {
|
132 |
+
throw new TypeException('$text must be of type string.');
|
133 |
+
}
|
134 |
+
$this->text = $text;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Retrieve text from a SubscriptionTracking object
|
139 |
+
*
|
140 |
+
* @return string
|
141 |
+
*/
|
142 |
+
public function getText()
|
143 |
+
{
|
144 |
+
return $this->text;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Add HTML to a SubscriptionTracking object
|
149 |
+
*
|
150 |
+
* @param string $html HTML to be appended to the email, with
|
151 |
+
* the subscription tracking link. You may
|
152 |
+
* control where the link is by using the
|
153 |
+
* tag <% %>
|
154 |
+
*
|
155 |
+
* @throws TypeException
|
156 |
+
*/
|
157 |
+
public function setHtml($html)
|
158 |
+
{
|
159 |
+
if (!is_string($html)) {
|
160 |
+
throw new TypeException('$html must be of type string.');
|
161 |
+
}
|
162 |
+
$this->html = $html;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Retrieve HTML from a SubscriptionTracking object
|
167 |
+
*
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
public function getHtml()
|
171 |
+
{
|
172 |
+
return $this->html;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Add a substitution tag to a SubscriptionTracking object
|
177 |
+
*
|
178 |
+
* @param string $substitution_tag A tag that will be replaced with the
|
179 |
+
* unsubscribe URL. for example:
|
180 |
+
* [unsubscribe_url]. If this parameter
|
181 |
+
* is used, it will override both the text
|
182 |
+
* and html parameters. The URL of the link
|
183 |
+
* will be placed at the substitution tag’s
|
184 |
+
* location, with no additional formatting %>
|
185 |
+
*
|
186 |
+
* @throws TypeException
|
187 |
+
*/
|
188 |
+
public function setSubstitutionTag($substitution_tag)
|
189 |
+
{
|
190 |
+
if (!is_string($substitution_tag)) {
|
191 |
+
throw new TypeException(
|
192 |
+
'$substitution_tag must be of type string.'
|
193 |
+
);
|
194 |
+
}
|
195 |
+
$this->substitution_tag = $substitution_tag;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Retrieve a substitution tag from a SubscriptionTracking object
|
200 |
+
*
|
201 |
+
* @return string
|
202 |
+
*/
|
203 |
+
public function getSubstitutionTag()
|
204 |
+
{
|
205 |
+
return $this->substitution_tag;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Return an array representing a SubscriptionTracking object
|
210 |
+
* for the Twilio SendGrid API
|
211 |
+
*
|
212 |
+
* @return null|array
|
213 |
+
*/
|
214 |
+
public function jsonSerialize()
|
215 |
+
{
|
216 |
+
return array_filter(
|
217 |
+
[
|
218 |
+
'enable' => $this->getEnable(),
|
219 |
+
'text' => $this->getText(),
|
220 |
+
'html' => $this->getHtml(),
|
221 |
+
'substitution_tag' => $this->getSubstitutionTag()
|
222 |
+
],
|
223 |
+
function ($value) {
|
224 |
+
return $value !== null;
|
225 |
+
}
|
226 |
+
) ?: null;
|
227 |
+
}
|
228 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/Substitution.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the Substitution object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a Substitution object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* A collection of key/value pairs following the pattern "substitution_tag":"value
|
21 |
+
* to substitute". All are assumed to be strings. These substitutions will apply
|
22 |
+
* to the text and html content of the body of your email, in addition to the
|
23 |
+
* subject and reply-to parameters. The total collective size of your substitutions
|
24 |
+
* may not exceed 10,000 bytes per personalization object
|
25 |
+
*
|
26 |
+
* @package SendGrid\Mail
|
27 |
+
*/
|
28 |
+
class Substitution implements \JsonSerializable
|
29 |
+
{
|
30 |
+
/** @var $key string Substitution key */
|
31 |
+
private $key;
|
32 |
+
/** @var $value string Substitution value */
|
33 |
+
private $value;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Optional constructor
|
37 |
+
*
|
38 |
+
* @param string|null $key Substitution key
|
39 |
+
* @param string|null $value Substitution value
|
40 |
+
*/
|
41 |
+
public function __construct($key = null, $value = null)
|
42 |
+
{
|
43 |
+
if (isset($key)) {
|
44 |
+
$this->setKey($key);
|
45 |
+
}
|
46 |
+
if (isset($value)) {
|
47 |
+
$this->setValue($value);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Add the key on a Substitution object
|
53 |
+
*
|
54 |
+
* @param string $key Substitution key
|
55 |
+
*
|
56 |
+
* @throws TypeException
|
57 |
+
* @return null
|
58 |
+
*/
|
59 |
+
public function setKey($key)
|
60 |
+
{
|
61 |
+
if (!is_string($key)) {
|
62 |
+
throw new TypeException('$key must be of type string.');
|
63 |
+
}
|
64 |
+
$this->key = (string) $key;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Retrieve the key from a Substitution object
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function getKey()
|
73 |
+
{
|
74 |
+
return $this->key;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Add the value on a Substitution object
|
79 |
+
*
|
80 |
+
* @param string|array|bool|int $value Substitution value
|
81 |
+
*
|
82 |
+
* @throws TypeException
|
83 |
+
* @return null
|
84 |
+
*/
|
85 |
+
public function setValue($value)
|
86 |
+
{
|
87 |
+
if (!is_string($value) && !is_array($value) && !is_object($value) &&!is_bool($value) &&!is_int($value)) {
|
88 |
+
throw new TypeException('$value must be of type string, array or object.');
|
89 |
+
}
|
90 |
+
$this->value = $value;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Retrieve the value from a Substitution object
|
95 |
+
*
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
public function getValue()
|
99 |
+
{
|
100 |
+
return $this->value;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Return an array representing a Substitution object for the Twilio SendGrid API
|
105 |
+
*
|
106 |
+
* @return null|array
|
107 |
+
*/
|
108 |
+
public function jsonSerialize()
|
109 |
+
{
|
110 |
+
return array_filter(
|
111 |
+
[
|
112 |
+
'key' => $this->getKey(),
|
113 |
+
'value' => $this->getValue()
|
114 |
+
],
|
115 |
+
function ($value) {
|
116 |
+
return $value !== null;
|
117 |
+
}
|
118 |
+
) ?: null;
|
119 |
+
}
|
120 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/TemplateId.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the TemplateId object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a TemplateId object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class TemplateId implements \JsonSerializable
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* @var $template_id string The id of a template that you would like to use. If you use a
|
26 |
+
* template that contains a subject and content (either text or html), you do
|
27 |
+
* not need to specify those at the personalizations nor message level
|
28 |
+
*/
|
29 |
+
private $template_id;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Optional constructor
|
33 |
+
*
|
34 |
+
* @param string|null $template_id The id of a template that you would like
|
35 |
+
* to use. If you use a template that contains
|
36 |
+
* a subject and content (either text or html),
|
37 |
+
* you do not need to specify those at the
|
38 |
+
* personalizations nor message level
|
39 |
+
*/
|
40 |
+
public function __construct($template_id = null)
|
41 |
+
{
|
42 |
+
if (isset($template_id)) {
|
43 |
+
$this->setTemplateId($template_id);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Add a template id to a TemplateId object
|
49 |
+
*
|
50 |
+
* @param string $template_id The id of a template that you would like
|
51 |
+
* to use. If you use a template that contains
|
52 |
+
* a subject and content (either text or html),
|
53 |
+
* you do not need to specify those at the
|
54 |
+
* personalizations nor message level
|
55 |
+
*
|
56 |
+
* @throws TypeException
|
57 |
+
*/
|
58 |
+
public function setTemplateId($template_id)
|
59 |
+
{
|
60 |
+
if (!is_string($template_id)) {
|
61 |
+
throw new TypeException('$template_id must be of type string.');
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->template_id = $template_id;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Retrieve a template id from a TemplateId object
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function getTemplateId()
|
73 |
+
{
|
74 |
+
return $this->template_id;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Return an array representing a TemplateId object for the Twilio SendGrid API
|
79 |
+
*
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
public function jsonSerialize()
|
83 |
+
{
|
84 |
+
return $this->getTemplateId();
|
85 |
+
}
|
86 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/To.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the To object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a To object for the /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Mail
|
21 |
+
*/
|
22 |
+
class To extends EmailAddress implements \JsonSerializable
|
23 |
+
{
|
24 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/TrackingSettings.php
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the TrackingSettings object for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Mail;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class is used to construct a TrackingSettings object for the
|
19 |
+
* /mail/send API call
|
20 |
+
*
|
21 |
+
* @package SendGrid\Mail
|
22 |
+
*/
|
23 |
+
class TrackingSettings implements \JsonSerializable
|
24 |
+
{
|
25 |
+
/** @var $click_tracking ClickTracking object */
|
26 |
+
private $click_tracking;
|
27 |
+
/** @var $open_tracking OpenTracking object */
|
28 |
+
private $open_tracking;
|
29 |
+
/** @var $subscription_tracking SubscriptionTracking object */
|
30 |
+
private $subscription_tracking;
|
31 |
+
/** @var $ganalytics Ganalytics object */
|
32 |
+
private $ganalytics;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Optional constructor
|
36 |
+
*
|
37 |
+
* @param ClickTracking|null $click_tracking ClickTracking object
|
38 |
+
* @param OpenTracking|null $open_tracking OpenTracking object
|
39 |
+
* @param SubscriptionTracking|null $subscription_tracking SubscriptionTracking
|
40 |
+
* object
|
41 |
+
* @param Ganalytics|null $ganalytics Ganalytics object
|
42 |
+
*/
|
43 |
+
public function __construct(
|
44 |
+
$click_tracking = null,
|
45 |
+
$open_tracking = null,
|
46 |
+
$subscription_tracking = null,
|
47 |
+
$ganalytics = null
|
48 |
+
)
|
49 |
+
{
|
50 |
+
if (isset($click_tracking)) {
|
51 |
+
$this->setClickTracking($click_tracking);
|
52 |
+
}
|
53 |
+
if (isset($open_tracking)) {
|
54 |
+
$this->setOpenTracking($open_tracking);
|
55 |
+
}
|
56 |
+
if (isset($subscription_tracking)) {
|
57 |
+
$this->setSubscriptionTracking($subscription_tracking);
|
58 |
+
}
|
59 |
+
if (isset($ganalytics)) {
|
60 |
+
$this->setGanalytics($ganalytics);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Set the click tracking settings on a TrackingSettings object
|
66 |
+
*
|
67 |
+
* @param ClickTracking|bool $enable The ClickTracking object or an
|
68 |
+
* indication if the setting is enabled
|
69 |
+
* @param bool|null $enable_text Indicates if this setting should be
|
70 |
+
* included in the text/plain portion of
|
71 |
+
* your email
|
72 |
+
*/
|
73 |
+
public function setClickTracking($enable, $enable_text = null)
|
74 |
+
{
|
75 |
+
if ($enable instanceof ClickTracking) {
|
76 |
+
$click_tracking = $enable;
|
77 |
+
$this->click_tracking = $click_tracking;
|
78 |
+
return;
|
79 |
+
}
|
80 |
+
$this->click_tracking = new ClickTracking($enable, $enable_text);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Retrieve the click tracking settings from a TrackingSettings object
|
85 |
+
*
|
86 |
+
* @return ClickTracking
|
87 |
+
*/
|
88 |
+
public function getClickTracking()
|
89 |
+
{
|
90 |
+
return $this->click_tracking;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Set the open tracking settings on a TrackingSettings object
|
95 |
+
*
|
96 |
+
* @param OpenTracking|bool $enable The ClickTracking object or an
|
97 |
+
* indication if the setting is
|
98 |
+
* enabled
|
99 |
+
* @param string|null $substitution_tag Allows you to specify a
|
100 |
+
* substitution tag that you can
|
101 |
+
* insert in the body of your email
|
102 |
+
* at a location that you desire.
|
103 |
+
* This tag will be replaced by
|
104 |
+
* the open tracking pixelail
|
105 |
+
*
|
106 |
+
* @return null
|
107 |
+
*/
|
108 |
+
public function setOpenTracking($enable, $substitution_tag = null)
|
109 |
+
{
|
110 |
+
if ($enable instanceof OpenTracking) {
|
111 |
+
$open_tracking = $enable;
|
112 |
+
$this->open_tracking = $open_tracking;
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
$this->open_tracking = new OpenTracking($enable, $substitution_tag);
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Retrieve the open tracking settings on a TrackingSettings object
|
121 |
+
*
|
122 |
+
* @return OpenTracking
|
123 |
+
*/
|
124 |
+
public function getOpenTracking()
|
125 |
+
{
|
126 |
+
return $this->open_tracking;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Set the subscription tracking settings on a TrackingSettings object
|
131 |
+
*
|
132 |
+
* @param SubscriptionTracking|bool $enable The SubscriptionTracking
|
133 |
+
* object or an indication
|
134 |
+
* if the setting is enabled
|
135 |
+
* @param string|null $text Text to be appended to the
|
136 |
+
* email, with the
|
137 |
+
* subscription tracking
|
138 |
+
* link. You may control
|
139 |
+
* where the link is by using
|
140 |
+
* the tag <% %>
|
141 |
+
* @param string|null $html HTML to be appended to the
|
142 |
+
* email, with the
|
143 |
+
* subscription tracking
|
144 |
+
* link. You may control
|
145 |
+
* where the link is by using
|
146 |
+
* the tag <% %>
|
147 |
+
* @param string|null $substitution_tag A tag that will be
|
148 |
+
* replaced with the
|
149 |
+
* unsubscribe URL. For
|
150 |
+
* example:
|
151 |
+
* [unsubscribe_url]. If this
|
152 |
+
* parameter is used, it will
|
153 |
+
* override both the text
|
154 |
+
* and html parameters. The
|
155 |
+
* URL of the link will be
|
156 |
+
* placed at the substitution
|
157 |
+
* tag’s location, with no
|
158 |
+
* additional formatting
|
159 |
+
*/
|
160 |
+
public function setSubscriptionTracking(
|
161 |
+
$enable,
|
162 |
+
$text = null,
|
163 |
+
$html = null,
|
164 |
+
$substitution_tag = null
|
165 |
+
) {
|
166 |
+
if ($enable instanceof SubscriptionTracking) {
|
167 |
+
$subscription_tracking = $enable;
|
168 |
+
$this->subscription_tracking = $subscription_tracking;
|
169 |
+
return;
|
170 |
+
}
|
171 |
+
$this->subscription_tracking
|
172 |
+
= new SubscriptionTracking($enable, $text, $html, $substitution_tag);
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Retrieve the subscription tracking settings from a TrackingSettings object
|
177 |
+
*
|
178 |
+
* @return SubscriptionTracking
|
179 |
+
*/
|
180 |
+
public function getSubscriptionTracking()
|
181 |
+
{
|
182 |
+
return $this->subscription_tracking;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Set the Google analytics settings on a TrackingSettings object
|
187 |
+
*
|
188 |
+
* @param Ganalytics|bool $enable The Ganalytics object or an indication
|
189 |
+
* if the setting is enabled
|
190 |
+
* @param string|null $utm_source Name of the referrer source. (e.g.
|
191 |
+
* Google, SomeDomain.com, or
|
192 |
+
* Marketing Email)
|
193 |
+
* @param string|null $utm_medium Name of the marketing medium. (e.g.
|
194 |
+
* Email)
|
195 |
+
* @param string|null $utm_term Used to identify any paid keywords
|
196 |
+
* @param string|null $utm_content Used to differentiate your campaign from
|
197 |
+
* advertisements
|
198 |
+
* @param string|null $utm_campaign The name of the campaign
|
199 |
+
*/
|
200 |
+
public function setGanalytics(
|
201 |
+
$enable,
|
202 |
+
$utm_source = null,
|
203 |
+
$utm_medium = null,
|
204 |
+
$utm_term = null,
|
205 |
+
$utm_content = null,
|
206 |
+
$utm_campaign = null
|
207 |
+
) {
|
208 |
+
if ($enable instanceof Ganalytics) {
|
209 |
+
$ganalytics = $enable;
|
210 |
+
$this->ganalytics = $ganalytics;
|
211 |
+
return;
|
212 |
+
}
|
213 |
+
$this->ganalytics = new Ganalytics(
|
214 |
+
$enable,
|
215 |
+
$utm_source,
|
216 |
+
$utm_medium,
|
217 |
+
$utm_term,
|
218 |
+
$utm_content,
|
219 |
+
$utm_campaign
|
220 |
+
);
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Retrieve the Google analytics settings from a TrackingSettings object
|
225 |
+
*
|
226 |
+
* @return Ganalytics
|
227 |
+
*/
|
228 |
+
public function getGanalytics()
|
229 |
+
{
|
230 |
+
return $this->ganalytics;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Return an array representing a TrackingSettings object for the Twilio SendGrid API
|
235 |
+
*
|
236 |
+
* @return null|array
|
237 |
+
*/
|
238 |
+
public function jsonSerialize()
|
239 |
+
{
|
240 |
+
return array_filter(
|
241 |
+
[
|
242 |
+
'click_tracking' => $this->getClickTracking(),
|
243 |
+
'open_tracking' => $this->getOpenTracking(),
|
244 |
+
'subscription_tracking' => $this->getSubscriptionTracking(),
|
245 |
+
'ganalytics' => $this->getGanalytics()
|
246 |
+
],
|
247 |
+
function ($value) {
|
248 |
+
return $value !== null;
|
249 |
+
}
|
250 |
+
) ?: null;
|
251 |
+
}
|
252 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/mail/TypeException.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace SendGrid\Mail;
|
3 |
+
|
4 |
+
class TypeException extends \Exception
|
5 |
+
{
|
6 |
+
|
7 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/stats/Stats.php
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper retrieves stats from a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Mail
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
namespace SendGrid\Stats;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* This class is used to retrieve stats from a /mail/send API call
|
18 |
+
*
|
19 |
+
* @package SendGrid\Mail
|
20 |
+
*/
|
21 |
+
class Stats
|
22 |
+
{
|
23 |
+
const DATE_FORMAT = 'Y-m-d';
|
24 |
+
const OPTIONS_SORT_DIRECTION = ['asc', 'desc'];
|
25 |
+
const OPTIONS_AGGREGATED_BY = ['day', 'week', 'month'];
|
26 |
+
|
27 |
+
// @var string
|
28 |
+
private $startDate;
|
29 |
+
|
30 |
+
// @var string
|
31 |
+
private $endDate;
|
32 |
+
|
33 |
+
// @var string
|
34 |
+
private $aggregatedBy;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Stats constructor
|
38 |
+
*
|
39 |
+
* @param string $startDate YYYYMMDD
|
40 |
+
* @param string $endDate YYYYMMDD
|
41 |
+
* @param string $aggregatedBy day|week|month
|
42 |
+
*/
|
43 |
+
public function __construct($startDate, $endDate = null, $aggregatedBy = null)
|
44 |
+
{
|
45 |
+
$this->validateDateFormat($startDate);
|
46 |
+
if (null !== $endDate) {
|
47 |
+
$this->validateDateFormat($endDate);
|
48 |
+
}
|
49 |
+
if (null !== $aggregatedBy) {
|
50 |
+
$this->validateOptions(
|
51 |
+
'aggregatedBy',
|
52 |
+
$aggregatedBy,
|
53 |
+
self::OPTIONS_AGGREGATED_BY
|
54 |
+
);
|
55 |
+
}
|
56 |
+
$this->startDate = $startDate;
|
57 |
+
$this->endDate = $endDate;
|
58 |
+
$this->aggregatedBy = $aggregatedBy;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve global stats parameters, start date, end date and
|
63 |
+
* aggregated by
|
64 |
+
*
|
65 |
+
* @return array
|
66 |
+
*/
|
67 |
+
public function getGlobal()
|
68 |
+
{
|
69 |
+
return [
|
70 |
+
'start_date' => $this->startDate,
|
71 |
+
'end_date' => $this->endDate,
|
72 |
+
'aggregated_by' => $this->aggregatedBy
|
73 |
+
];
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Retrieve an array of categories
|
78 |
+
*
|
79 |
+
* @param array $categories
|
80 |
+
*
|
81 |
+
* @return array
|
82 |
+
* @throws \Exception
|
83 |
+
*/
|
84 |
+
public function getCategory($categories)
|
85 |
+
{
|
86 |
+
$this->validateNumericArray('categories', $categories);
|
87 |
+
$stats = $this->getGlobal();
|
88 |
+
$stats['categories'] = $categories;
|
89 |
+
return $stats;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Retrieve global stats parameters, start date, end date and
|
94 |
+
* aggregated for the given set of subusers
|
95 |
+
*
|
96 |
+
* @param array $subusers Subuser accounts
|
97 |
+
*
|
98 |
+
* @return array
|
99 |
+
* @throws \Exception
|
100 |
+
*/
|
101 |
+
public function getSubuser($subusers)
|
102 |
+
{
|
103 |
+
$this->validateNumericArray('subusers', $subusers);
|
104 |
+
$stats = $this->getGlobal();
|
105 |
+
$stats['subusers'] = $subusers;
|
106 |
+
return $stats;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Retrieve global stats parameters, start date, end date,
|
111 |
+
* aggregated by, sort by metric, sort by direction, limit
|
112 |
+
* and offset
|
113 |
+
*
|
114 |
+
* @param string $sortByMetric blocks|bounce_drops|bounces|
|
115 |
+
* clicks|deferred|delivered|
|
116 |
+
* invalid_emails|opens|processed|
|
117 |
+
* requests|spam_report_drops|
|
118 |
+
* spam_reports|unique_clicks|
|
119 |
+
* unique_opens|unsubscribe_drops|
|
120 |
+
* unsubsribes
|
121 |
+
* @param string $sortByDirection asc|desc
|
122 |
+
* @param integer $limit The number of results to return
|
123 |
+
* @param integer $offset The point in the list to begin
|
124 |
+
* retrieving results
|
125 |
+
*
|
126 |
+
* @return array
|
127 |
+
* @throws \Exception
|
128 |
+
*/
|
129 |
+
public function getSum(
|
130 |
+
$sortByMetric = 'delivered',
|
131 |
+
$sortByDirection = 'desc',
|
132 |
+
$limit = 5, $offset = 0
|
133 |
+
) {
|
134 |
+
$this->validateOptions(
|
135 |
+
'sortByDirection',
|
136 |
+
$sortByDirection,
|
137 |
+
self::OPTIONS_SORT_DIRECTION
|
138 |
+
);
|
139 |
+
$this->validateInteger('limit', $limit);
|
140 |
+
$this->validateInteger('offset', $offset);
|
141 |
+
$stats = $this->getGlobal();
|
142 |
+
$stats['sort_by_metric'] = $sortByMetric;
|
143 |
+
$stats['sort_by_direction'] = $sortByDirection;
|
144 |
+
$stats['limit'] = $limit;
|
145 |
+
$stats['offset'] = $offset;
|
146 |
+
return $stats;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Retrieve monthly stats by subuser
|
151 |
+
*
|
152 |
+
* @param string $subuser Subuser account
|
153 |
+
* @param string $sortByMetric blocks|bounce_drops|bounces|
|
154 |
+
* clicks|deferred|delivered|
|
155 |
+
* invalid_emails|opens|processed|
|
156 |
+
* requests|spam_report_drops|
|
157 |
+
* spam_reports|unique_clicks|
|
158 |
+
* unique_opens|unsubscribe_drops|
|
159 |
+
* unsubsribes
|
160 |
+
* @param string $sortByDirection asc|desc
|
161 |
+
* @param integer $limit The number of results to return
|
162 |
+
* @param integer $offset The point in the list to begin
|
163 |
+
* retrieving results
|
164 |
+
*
|
165 |
+
* @return array
|
166 |
+
* @throws \Exception
|
167 |
+
*/
|
168 |
+
public function getSubuserMonthly(
|
169 |
+
$subuser = null,
|
170 |
+
$sortByMetric = 'delivered',
|
171 |
+
$sortByDirection = 'desc',
|
172 |
+
$limit = 5,
|
173 |
+
$offset = 0
|
174 |
+
) {
|
175 |
+
$this->validateOptions(
|
176 |
+
'sortByDirection',
|
177 |
+
$sortByDirection,
|
178 |
+
self::OPTIONS_SORT_DIRECTION
|
179 |
+
);
|
180 |
+
$this->validateInteger('limit', $limit);
|
181 |
+
$this->validateInteger('offset', $offset);
|
182 |
+
return [
|
183 |
+
'date' => $this->startDate,
|
184 |
+
'subuser' => $subuser,
|
185 |
+
'sort_by_metric' => $sortByMetric,
|
186 |
+
'sort_by_direction' => $sortByDirection,
|
187 |
+
'limit' => $limit,
|
188 |
+
'offset' => $offset
|
189 |
+
];
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Validate the date format
|
194 |
+
*
|
195 |
+
* @param string $date YYYY-MM-DD
|
196 |
+
*
|
197 |
+
* @return null
|
198 |
+
* @throws \Exception
|
199 |
+
*/
|
200 |
+
protected function validateDateFormat($date)
|
201 |
+
{
|
202 |
+
if (false === \DateTime::createFromFormat(self::DATE_FORMAT, $date)) {
|
203 |
+
throw new \Exception('Date must be in the YYYY-MM-DD format.');
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Validate options
|
209 |
+
*
|
210 |
+
* @param string $name Name of option
|
211 |
+
* @param string $value Value of option
|
212 |
+
* @param array $options Array of options
|
213 |
+
*
|
214 |
+
* @return null
|
215 |
+
* @throws \Exception
|
216 |
+
*/
|
217 |
+
protected function validateOptions($name, $value, $options)
|
218 |
+
{
|
219 |
+
if (!in_array($value, $options)) {
|
220 |
+
throw new \Exception(
|
221 |
+
$name . ' must be one of: ' . implode(', ', $options)
|
222 |
+
);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Validate integer
|
228 |
+
*
|
229 |
+
* @param string $name Name as a string
|
230 |
+
* @param integer $value Value as an integer
|
231 |
+
*
|
232 |
+
* @return null
|
233 |
+
* @throws \Exception
|
234 |
+
*/
|
235 |
+
protected function validateInteger($name, $value)
|
236 |
+
{
|
237 |
+
if (!is_integer($value)) {
|
238 |
+
throw new \Exception($name . ' must be an integer.');
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Validate a numeric array
|
244 |
+
*
|
245 |
+
* @param string $name Name as a string
|
246 |
+
* @param array $value Value as an array of integers
|
247 |
+
*
|
248 |
+
* @return null
|
249 |
+
* @throws \Exception
|
250 |
+
*/
|
251 |
+
protected function validateNumericArray($name, $value)
|
252 |
+
{
|
253 |
+
if (!is_array($value) || empty($value) || !$this->isNumeric($value)) {
|
254 |
+
throw new \Exception($name . ' must be a non-empty numeric array.');
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Determine if the array is numeric
|
260 |
+
*
|
261 |
+
* @param array $array Array of values
|
262 |
+
*
|
263 |
+
* @return bool
|
264 |
+
*/
|
265 |
+
protected function isNumeric(array $array)
|
266 |
+
{
|
267 |
+
return array_keys($array) == range(0, count($array) - 1);
|
268 |
+
}
|
269 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/phpcs.xml
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset name="PSR2">
|
3 |
+
<description>The PSR-2 coding standard.</description>
|
4 |
+
<arg name="tab-width" value="4"/>
|
5 |
+
|
6 |
+
<!-- 2. General -->
|
7 |
+
|
8 |
+
<!-- 2.1 Basic Coding Standard -->
|
9 |
+
|
10 |
+
<!-- Include the whole PSR-1 standard -->
|
11 |
+
<rule ref="PSR1"/>
|
12 |
+
|
13 |
+
<!-- 2.2 Files -->
|
14 |
+
|
15 |
+
<!-- All PHP files MUST use the Unix LF (linefeed) line ending. -->
|
16 |
+
<rule ref="Generic.Files.LineEndings">
|
17 |
+
<properties>
|
18 |
+
<property name="eolChar" value="\n"/>
|
19 |
+
</properties>
|
20 |
+
</rule>
|
21 |
+
|
22 |
+
<!-- All PHP files MUST end with a single blank line. -->
|
23 |
+
<!-- checked in Files/EndFileNewlineSniff -->
|
24 |
+
|
25 |
+
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
|
26 |
+
<!-- checked in Files/ClosingTagSniff -->
|
27 |
+
|
28 |
+
<!-- 2.3 Lines -->
|
29 |
+
|
30 |
+
<!-- The soft limit on line length MUST be 120 characters; automated style checkers MUST warn but MUST NOT error at the soft limit. -->
|
31 |
+
<rule ref="Generic.Files.LineLength">
|
32 |
+
<properties>
|
33 |
+
<property name="lineLimit" value="120"/>
|
34 |
+
<property name="absoluteLineLimit" value="0"/>
|
35 |
+
</properties>
|
36 |
+
</rule>
|
37 |
+
|
38 |
+
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
39 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
40 |
+
<severity>0</severity>
|
41 |
+
</rule>
|
42 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
|
43 |
+
<severity>0</severity>
|
44 |
+
</rule>
|
45 |
+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
46 |
+
<severity>0</severity>
|
47 |
+
</rule>
|
48 |
+
|
49 |
+
<!-- There MUST NOT be more than one statement per line. -->
|
50 |
+
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
51 |
+
|
52 |
+
<!-- 2.4 Indenting -->
|
53 |
+
|
54 |
+
<!-- Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting. -->
|
55 |
+
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
56 |
+
<properties>
|
57 |
+
<property name="ignoreIndentationTokens" type="array">
|
58 |
+
<element value="T_COMMENT"/>
|
59 |
+
<element value="T_DOC_COMMENT_OPEN_TAG"/>
|
60 |
+
</property>
|
61 |
+
</properties>
|
62 |
+
</rule>
|
63 |
+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
64 |
+
|
65 |
+
<!-- 2.5 Keywords and True/False/Null -->
|
66 |
+
|
67 |
+
<!-- PHP keywords MUST be in lower case. -->
|
68 |
+
<rule ref="Generic.PHP.LowerCaseKeyword"/>
|
69 |
+
|
70 |
+
<!-- The PHP constants true, false, and null MUST be in lower case. -->
|
71 |
+
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
72 |
+
|
73 |
+
<!-- 3. Namespace and Use Declarations -->
|
74 |
+
|
75 |
+
<!-- When present, there MUST be one blank line after the namespace declaration. -->
|
76 |
+
<!-- checked in Namespaces/NamespaceDeclarationSniff -->
|
77 |
+
|
78 |
+
<!-- When present, all use declarations MUST go after the namespace declaration.
|
79 |
+
There MUST be one use keyword per declaration.
|
80 |
+
There MUST be one blank line after the use block. -->
|
81 |
+
<!-- checked in Namespaces/UseDeclarationSniff -->
|
82 |
+
|
83 |
+
<!-- 4. Classes, Properties, and Methods -->
|
84 |
+
|
85 |
+
<!-- 4.1. Extends and Implements -->
|
86 |
+
|
87 |
+
<!-- The extends and implements keywords MUST be declared on the same line as the class name.
|
88 |
+
The opening brace for the class go MUST go on its own line; the closing brace for the class MUST go on the next line after the body.
|
89 |
+
Lists of implements MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one interface per line. -->
|
90 |
+
<!-- checked in Classes/ClassDeclarationSniff -->
|
91 |
+
|
92 |
+
<!-- 4.2. Properties -->
|
93 |
+
|
94 |
+
<!-- Visibility MUST be declared on all properties.
|
95 |
+
The var keyword MUST NOT be used to declare a property.
|
96 |
+
There MUST NOT be more than one property declared per statement.
|
97 |
+
Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. -->
|
98 |
+
<!-- checked in Classes/PropertyDeclarationSniff -->
|
99 |
+
|
100 |
+
<!-- 4.3 Methods -->
|
101 |
+
|
102 |
+
<!-- Visibility MUST be declared on all methods. -->
|
103 |
+
<rule ref="Squiz.Scope.MethodScope"/>
|
104 |
+
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
|
105 |
+
|
106 |
+
<!-- Method names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. -->
|
107 |
+
<!-- checked in Methods/MethodDeclarationSniff -->
|
108 |
+
|
109 |
+
<!-- Method names MUST NOT be declared with a space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. -->
|
110 |
+
<!-- checked in Methods/FunctionClosingBraceSniff -->
|
111 |
+
<rule ref="Squiz.Functions.FunctionDeclaration"/>
|
112 |
+
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
|
113 |
+
|
114 |
+
<!-- 4.4 Method Arguments -->
|
115 |
+
|
116 |
+
<!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
|
117 |
+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
118 |
+
<properties>
|
119 |
+
<property name="equalsSpacing" value="1"/>
|
120 |
+
</properties>
|
121 |
+
</rule>
|
122 |
+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
|
123 |
+
<severity>0</severity>
|
124 |
+
</rule>
|
125 |
+
|
126 |
+
<!-- Method arguments with default values MUST go at the end of the argument list. -->
|
127 |
+
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
128 |
+
|
129 |
+
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
130 |
+
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
|
131 |
+
|
132 |
+
<!-- 4.5 abstract, final, and static -->
|
133 |
+
|
134 |
+
<!-- When present, the abstract and final declarations MUST precede the visibility declaration.
|
135 |
+
When present, the static declaration MUST come after the visibility declaration. -->
|
136 |
+
<!-- checked in Methods/MethodDeclarationSniff -->
|
137 |
+
|
138 |
+
<!-- 4.6 Method and Function Calls -->
|
139 |
+
|
140 |
+
<!-- When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma.
|
141 |
+
Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. -->
|
142 |
+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
143 |
+
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
|
144 |
+
<severity>0</severity>
|
145 |
+
</rule>
|
146 |
+
<rule ref="PSR2.Methods.FunctionCallSignature.OpeningIndent">
|
147 |
+
<severity>0</severity>
|
148 |
+
</rule>
|
149 |
+
|
150 |
+
<!-- 5. Control Structures -->
|
151 |
+
|
152 |
+
<!-- The general style rules for control structures are as follows:
|
153 |
+
There MUST be one space after the control structure keyword
|
154 |
+
There MUST NOT be a space after the opening parenthesis
|
155 |
+
There MUST NOT be a space before the closing parenthesis
|
156 |
+
There MUST be one space between the closing parenthesis and the opening brace
|
157 |
+
The structure body MUST be indented once
|
158 |
+
The closing brace MUST be on the next line after the body -->
|
159 |
+
<rule ref="Squiz.ControlStructures.ControlSignature"/>
|
160 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
|
161 |
+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
|
162 |
+
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
163 |
+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
|
164 |
+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
|
165 |
+
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
|
166 |
+
<!-- checked in ControlStructures/ControlStructureSpacingSniff -->
|
167 |
+
|
168 |
+
<!-- exclude this message as it is already checked Generic.PHP.LowerCaseKeyword -->
|
169 |
+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
|
170 |
+
<severity>0</severity>
|
171 |
+
</rule>
|
172 |
+
|
173 |
+
<!-- The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. -->
|
174 |
+
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
175 |
+
|
176 |
+
<!-- 5.1. if, elseif, else -->
|
177 |
+
|
178 |
+
<!-- The keyword elseif SHOULD be used instead of else if so that all control keywords look like single words. -->
|
179 |
+
<!-- checked in ControlStructures/ElseIfDeclarationSniff -->
|
180 |
+
|
181 |
+
<!-- 5.2. switch, case -->
|
182 |
+
|
183 |
+
<!-- The case statement MUST be indented once from switch, and the break keyword (or other terminating keyword) MUST be indented at the same level as the case body. There MUST be a comment such as // no break when fall-through is intentional in a non-empty case body. -->
|
184 |
+
<!-- checked in ControlStructures/SwitchDeclarationSniff -->
|
185 |
+
|
186 |
+
<!-- 6. Closures -->
|
187 |
+
|
188 |
+
<!-- Closures MUST be declared with a space after the function keyword, and a space before and after the use keyword.
|
189 |
+
The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body.
|
190 |
+
There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list.
|
191 |
+
In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma.
|
192 |
+
Closure arguments with default values MUST go at the end of the argument list.
|
193 |
+
Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line.
|
194 |
+
When the ending list (whether or arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
|
195 |
+
<!-- checked in Squiz.Functions.MultiLineFunctionDeclaration -->
|
196 |
+
</ruleset>
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/scripts/package.sh
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
rm -rf vendor composer.lock
|
4 |
+
composer install --no-dev
|
5 |
+
printf "<?php\nrequire __DIR__ . '/vendor/autoload.php';\n?>" > sendgrid-php.php
|
6 |
+
cd ..
|
7 |
+
zip -r sendgrid-php.zip sendgrid-php -x \*.git\* \*composer.json\* \*scripts\* \*test\* \*.travis.yml\* \*prism\*
|
8 |
+
|
9 |
+
exit 0
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/sendgrid-php.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
?>
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/BaseTestClass.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file contains the base class for testing the request object
|
4 |
+
* generation for a /mail/send API call
|
5 |
+
*
|
6 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
7 |
+
*
|
8 |
+
* @package SendGrid\Tests
|
9 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
10 |
+
* @copyright 2018-19 Twilio SendGrid
|
11 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
12 |
+
* @version GIT: <git_id>
|
13 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
14 |
+
*/
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
use PHPUnit\Framework\TestCase;
|
18 |
+
use Swaggest\JsonDiff\JsonDiff;
|
19 |
+
use Swaggest\JsonDiff\JsonPatch;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* This class facilitates testing the request object
|
23 |
+
* generation for a /mail/send API call
|
24 |
+
*
|
25 |
+
* @package SendGrid\Mail
|
26 |
+
*/
|
27 |
+
class BaseTestClass extends TestCase
|
28 |
+
{
|
29 |
+
// @var string Twilio SendGrid API Key
|
30 |
+
protected static $apiKey;
|
31 |
+
// @var SendGrid Twilio SendGrid client
|
32 |
+
protected static $sg;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* This method is run before the classes are initialised
|
36 |
+
*
|
37 |
+
* @return null
|
38 |
+
*/
|
39 |
+
public static function setUpBeforeClass()
|
40 |
+
{
|
41 |
+
self::$apiKey = "SENDGRID_API_KEY";
|
42 |
+
$host = ['host' => 'http://localhost:4010'];
|
43 |
+
self::$sg = new \SendGrid(self::$apiKey, $host);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Compares to JSON objects and returns True if equal,
|
48 |
+
* else return array of differences
|
49 |
+
*
|
50 |
+
* @param string $json1 A string representation of a JSON object
|
51 |
+
* @param string $json2 A string representation of a JSON object
|
52 |
+
*
|
53 |
+
* @return bool|array
|
54 |
+
*/
|
55 |
+
public static function compareJSONObjects($json1, $json2)
|
56 |
+
{
|
57 |
+
$diff = new JsonDiff(
|
58 |
+
json_decode($json1),
|
59 |
+
json_decode($json2),
|
60 |
+
JsonDiff::REARRANGE_ARRAYS
|
61 |
+
);
|
62 |
+
$patch = $diff->getPatch();
|
63 |
+
$patch_array = JsonPatch::export($patch);
|
64 |
+
if (empty($patch_array)) {
|
65 |
+
return true;
|
66 |
+
} else {
|
67 |
+
return $patch_array;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/data/test.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
hello
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Alerts/AlertsTest.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests;
|
4 |
+
|
5 |
+
class AlertsTest extends BaseTestClass
|
6 |
+
{
|
7 |
+
public function testAlertsPostMethod()
|
8 |
+
{
|
9 |
+
$request_body = json_decode('{
|
10 |
+
"email_to": "example@example.com",
|
11 |
+
"frequency": "daily",
|
12 |
+
"type": "stats_notification"
|
13 |
+
}');
|
14 |
+
$request_headers = ["X-Mock: 201"];
|
15 |
+
$response = self::$sg->client->alerts()->post($request_body, null, $request_headers);
|
16 |
+
$this->assertEquals(201, $response->statusCode());
|
17 |
+
}
|
18 |
+
|
19 |
+
public function testAlertsGetMethod()
|
20 |
+
{
|
21 |
+
$request_headers = ["X-Mock: 200"];
|
22 |
+
$response = self::$sg->client->alerts()->get(null, null, $request_headers);
|
23 |
+
$this->assertEquals(200, $response->statusCode());
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testAlertsIdPatchMethod()
|
27 |
+
{
|
28 |
+
$request_body = json_decode('{
|
29 |
+
"email_to": "example@example.com"
|
30 |
+
}');
|
31 |
+
$alert_id = "test_url_param";
|
32 |
+
$request_headers = ["X-Mock: 200"];
|
33 |
+
$response = self::$sg->client->alerts()->_($alert_id)->patch($request_body, null, $request_headers);
|
34 |
+
$this->assertEquals(200, $response->statusCode());
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testAlertsIdGetMethod()
|
38 |
+
{
|
39 |
+
$alert_id = "test_url_param";
|
40 |
+
$request_headers = ["X-Mock: 200"];
|
41 |
+
$response = self::$sg->client->alerts()->_($alert_id)->get(null, null, $request_headers);
|
42 |
+
$this->assertEquals(200, $response->statusCode());
|
43 |
+
}
|
44 |
+
|
45 |
+
public function testAlertsIdDeleteMethod()
|
46 |
+
{
|
47 |
+
$alert_id = "test_url_param";
|
48 |
+
$request_headers = ["X-Mock: 204"];
|
49 |
+
$response = self::$sg->client->alerts()->_($alert_id)->delete(null, null, $request_headers);
|
50 |
+
$this->assertEquals(204, $response->statusCode());
|
51 |
+
}
|
52 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/ApiKeys/ApiKeysTest.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\ApiKeys;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class ApiKeysTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testApiKeysPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"name": "My API Key",
|
13 |
+
"sample": "data",
|
14 |
+
"scopes": [
|
15 |
+
"mail.send",
|
16 |
+
"alerts.create",
|
17 |
+
"alerts.read"
|
18 |
+
]
|
19 |
+
}');
|
20 |
+
$request_headers = ["X-Mock: 201"];
|
21 |
+
$response = self::$sg->client->api_keys()->post($request_body, null, $request_headers);
|
22 |
+
$this->assertEquals(201, $response->statusCode());
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testApiKeysGetMethod()
|
26 |
+
{
|
27 |
+
$query_params = json_decode('{"limit": 1}');
|
28 |
+
$request_headers = ["X-Mock: 200"];
|
29 |
+
$response = self::$sg->client->api_keys()->get(null, $query_params, $request_headers);
|
30 |
+
$this->assertEquals(200, $response->statusCode());
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testApiKeysIdPutMethod()
|
34 |
+
{
|
35 |
+
$request_body = json_decode('{
|
36 |
+
"name": "A New Hope",
|
37 |
+
"scopes": [
|
38 |
+
"user.profile.read",
|
39 |
+
"user.profile.update"
|
40 |
+
]
|
41 |
+
}');
|
42 |
+
$api_key_id = "test_url_param";
|
43 |
+
$request_headers = ["X-Mock: 200"];
|
44 |
+
$response = self::$sg->client->api_keys()->_($api_key_id)->put($request_body, null, $request_headers);
|
45 |
+
$this->assertEquals(200, $response->statusCode());
|
46 |
+
}
|
47 |
+
|
48 |
+
public function testApiKeysIdPatchMethod()
|
49 |
+
{
|
50 |
+
$request_body = json_decode('{
|
51 |
+
"name": "A New Hope"
|
52 |
+
}');
|
53 |
+
$api_key_id = "test_url_param";
|
54 |
+
$request_headers = ["X-Mock: 200"];
|
55 |
+
$response = self::$sg->client->api_keys()->_($api_key_id)->patch($request_body, null, $request_headers);
|
56 |
+
$this->assertEquals(200, $response->statusCode());
|
57 |
+
}
|
58 |
+
|
59 |
+
public function testApiKeysIdGetMethod()
|
60 |
+
{
|
61 |
+
$api_key_id = "test_url_param";
|
62 |
+
$request_headers = ["X-Mock: 200"];
|
63 |
+
$response = self::$sg->client->api_keys()->_($api_key_id)->get(null, null, $request_headers);
|
64 |
+
$this->assertEquals(200, $response->statusCode());
|
65 |
+
}
|
66 |
+
|
67 |
+
public function testApiKeysIdDeleteMethod()
|
68 |
+
{
|
69 |
+
$api_key_id = "test_url_param";
|
70 |
+
$request_headers = ["X-Mock: 204"];
|
71 |
+
$response = self::$sg->client->api_keys()->_($api_key_id)->delete(null, null, $request_headers);
|
72 |
+
$this->assertEquals(204, $response->statusCode());
|
73 |
+
}
|
74 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Asm/AsmGroupsTest.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Asm;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class AsmGroupsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testAsmGroupsPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"description": "Suggestions for products our users might like.",
|
13 |
+
"is_default": true,
|
14 |
+
"name": "Product Suggestions"
|
15 |
+
}');
|
16 |
+
$request_headers = ["X-Mock: 201"];
|
17 |
+
$response = self::$sg->client->asm()->groups()->post($request_body, null, $request_headers);
|
18 |
+
$this->assertEquals(201, $response->statusCode());
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testAsmGroupsGetMethod()
|
22 |
+
{
|
23 |
+
$query_params = json_decode('{"id": 1}');
|
24 |
+
$request_headers = ["X-Mock: 200"];
|
25 |
+
$response = self::$sg->client->asm()->groups()->get(null, $query_params, $request_headers);
|
26 |
+
$this->assertEquals(200, $response->statusCode());
|
27 |
+
}
|
28 |
+
|
29 |
+
public function testAsmGroupsIdPatchMethod()
|
30 |
+
{
|
31 |
+
$request_body = json_decode('{
|
32 |
+
"description": "Suggestions for items our users might like.",
|
33 |
+
"id": 103,
|
34 |
+
"name": "Item Suggestions"
|
35 |
+
}');
|
36 |
+
$group_id = "test_url_param";
|
37 |
+
$request_headers = ["X-Mock: 201"];
|
38 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->patch($request_body, null, $request_headers);
|
39 |
+
$this->assertEquals(201, $response->statusCode());
|
40 |
+
}
|
41 |
+
|
42 |
+
public function testAsmGroupsIdGetMethod()
|
43 |
+
{
|
44 |
+
$group_id = "test_url_param";
|
45 |
+
$request_headers = ["X-Mock: 200"];
|
46 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->get(null, null, $request_headers);
|
47 |
+
$this->assertEquals(200, $response->statusCode());
|
48 |
+
}
|
49 |
+
|
50 |
+
public function testAsmGroupsIdDeleteMethod()
|
51 |
+
{
|
52 |
+
$group_id = "test_url_param";
|
53 |
+
$request_headers = ["X-Mock: 204"];
|
54 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->delete(null, null, $request_headers);
|
55 |
+
$this->assertEquals(204, $response->statusCode());
|
56 |
+
}
|
57 |
+
|
58 |
+
public function testAsmGroupsIdSuppressionPostMethod()
|
59 |
+
{
|
60 |
+
$request_body = json_decode('{
|
61 |
+
"recipient_emails": [
|
62 |
+
"test1@example.com",
|
63 |
+
"test2@example.com"
|
64 |
+
]
|
65 |
+
}');
|
66 |
+
$group_id = "test_url_param";
|
67 |
+
$request_headers = ["X-Mock: 201"];
|
68 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->post($request_body, null, $request_headers);
|
69 |
+
$this->assertEquals(201, $response->statusCode());
|
70 |
+
}
|
71 |
+
|
72 |
+
public function testAsmGroupsIdSuppressionGetMethod()
|
73 |
+
{
|
74 |
+
$group_id = "test_url_param";
|
75 |
+
$request_headers = ["X-Mock: 200"];
|
76 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->get(null, null, $request_headers);
|
77 |
+
$this->assertEquals(200, $response->statusCode());
|
78 |
+
}
|
79 |
+
|
80 |
+
public function testAsmGroupsIdSuppressionSearchPostMethod()
|
81 |
+
{
|
82 |
+
$request_body = json_decode('{
|
83 |
+
"recipient_emails": [
|
84 |
+
"exists1@example.com",
|
85 |
+
"exists2@example.com",
|
86 |
+
"doesnotexists@example.com"
|
87 |
+
]
|
88 |
+
}');
|
89 |
+
$group_id = "test_url_param";
|
90 |
+
$request_headers = ["X-Mock: 200"];
|
91 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->search()
|
92 |
+
->post($request_body, null, $request_headers);
|
93 |
+
$this->assertEquals(200, $response->statusCode());
|
94 |
+
}
|
95 |
+
|
96 |
+
public function testAsmGroupsIdSuppressionEmailDeleteMethod()
|
97 |
+
{
|
98 |
+
$group_id = "test_url_param";
|
99 |
+
$email = "test_url_param";
|
100 |
+
$request_headers = ["X-Mock: 204"];
|
101 |
+
$response = self::$sg->client->asm()->groups()->_($group_id)->suppressions()->_($email)
|
102 |
+
->delete(null, null, $request_headers);
|
103 |
+
$this->assertEquals(204, $response->statusCode());
|
104 |
+
}
|
105 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Asm/AsmSuppressionTest.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Asm;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class AsmSuppressionTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testAsmSuppressionGetMethod()
|
10 |
+
{
|
11 |
+
$request_headers = ["X-Mock: 200"];
|
12 |
+
$response = self::$sg->client->asm()->suppressions()->get(null, null, $request_headers);
|
13 |
+
$this->assertEquals(200, $response->statusCode());
|
14 |
+
}
|
15 |
+
|
16 |
+
public function testAsmSuppressionGlobalPostMethod()
|
17 |
+
{
|
18 |
+
$request_body = json_decode('{
|
19 |
+
"recipient_emails": [
|
20 |
+
"test1@example.com",
|
21 |
+
"test2@example.com"
|
22 |
+
]
|
23 |
+
}');
|
24 |
+
$request_headers = ["X-Mock: 201"];
|
25 |
+
$response = self::$sg->client->asm()->suppressions()->global()->post($request_body, null, $request_headers);
|
26 |
+
$this->assertEquals(201, $response->statusCode());
|
27 |
+
}
|
28 |
+
|
29 |
+
public function testAsmSuppressionGlobalEmailGetMethod()
|
30 |
+
{
|
31 |
+
$email = "test_url_param";
|
32 |
+
$request_headers = ["X-Mock: 200"];
|
33 |
+
$response = self::$sg->client->asm()->suppressions()->global()->_($email)->get(null, null, $request_headers);
|
34 |
+
$this->assertEquals(200, $response->statusCode());
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testAsmSuppressionGlobalEmailDeleteMethod()
|
38 |
+
{
|
39 |
+
$email = "test_url_param";
|
40 |
+
$request_headers = ["X-Mock: 204"];
|
41 |
+
$response = self::$sg->client->asm()->suppressions()->global()->_($email)->delete(null, null, $request_headers);
|
42 |
+
$this->assertEquals(204, $response->statusCode());
|
43 |
+
}
|
44 |
+
|
45 |
+
public function testAsmSuppressionEmailGetMethod()
|
46 |
+
{
|
47 |
+
$email = "test_url_param";
|
48 |
+
$request_headers = ["X-Mock: 200"];
|
49 |
+
$response = self::$sg->client->asm()->suppressions()->_($email)->get(null, null, $request_headers);
|
50 |
+
$this->assertEquals(200, $response->statusCode());
|
51 |
+
}
|
52 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Campaigns/CampaignsTest.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Campaigns;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class CampaignsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testCampaignsPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"categories": [
|
13 |
+
"spring line"
|
14 |
+
],
|
15 |
+
"custom_unsubscribe_url": "",
|
16 |
+
"html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>",
|
17 |
+
"ip_pool": "marketing",
|
18 |
+
"list_ids": [
|
19 |
+
110,
|
20 |
+
124
|
21 |
+
],
|
22 |
+
"plain_content": "Check out our spring line!",
|
23 |
+
"segment_ids": [
|
24 |
+
110
|
25 |
+
],
|
26 |
+
"sender_id": 124451,
|
27 |
+
"subject": "New Products for Spring!",
|
28 |
+
"suppression_group_id": 42,
|
29 |
+
"title": "March Newsletter"
|
30 |
+
}');
|
31 |
+
$request_headers = ["X-Mock: 201"];
|
32 |
+
$response = self::$sg->client->campaigns()->post($request_body, null, $request_headers);
|
33 |
+
$this->assertEquals(201, $response->statusCode());
|
34 |
+
}
|
35 |
+
|
36 |
+
public function testCampaignsGetMethod()
|
37 |
+
{
|
38 |
+
$query_params = json_decode('{"limit": 1, "offset": 1}');
|
39 |
+
$request_headers = ["X-Mock: 200"];
|
40 |
+
$response = self::$sg->client->campaigns()->get(null, $query_params, $request_headers);
|
41 |
+
$this->assertEquals(200, $response->statusCode());
|
42 |
+
}
|
43 |
+
|
44 |
+
public function testCampaignsIdPatchMethod()
|
45 |
+
{
|
46 |
+
$request_body = json_decode('{
|
47 |
+
"categories": [
|
48 |
+
"summer line"
|
49 |
+
],
|
50 |
+
"html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>",
|
51 |
+
"plain_content": "Check out our summer line!",
|
52 |
+
"subject": "New Products for Summer!",
|
53 |
+
"title": "May Newsletter"
|
54 |
+
}');
|
55 |
+
$campaign_id = "test_url_param";
|
56 |
+
$request_headers = ["X-Mock: 200"];
|
57 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->patch($request_body, null, $request_headers);
|
58 |
+
$this->assertEquals(200, $response->statusCode());
|
59 |
+
}
|
60 |
+
|
61 |
+
public function testCampaignsIdGetMethod()
|
62 |
+
{
|
63 |
+
$campaign_id = "test_url_param";
|
64 |
+
$request_headers = ["X-Mock: 200"];
|
65 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->get(null, null, $request_headers);
|
66 |
+
$this->assertEquals(200, $response->statusCode());
|
67 |
+
}
|
68 |
+
|
69 |
+
public function testCampaignsIdDeleteMethod()
|
70 |
+
{
|
71 |
+
$campaign_id = "test_url_param";
|
72 |
+
$request_headers = ["X-Mock: 204"];
|
73 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->delete(null, null, $request_headers);
|
74 |
+
$this->assertEquals(204, $response->statusCode());
|
75 |
+
}
|
76 |
+
|
77 |
+
public function testCampaignsIdSchedulesPatchMethod()
|
78 |
+
{
|
79 |
+
$request_body = json_decode('{
|
80 |
+
"send_at": 1489451436
|
81 |
+
}');
|
82 |
+
$campaign_id = "test_url_param";
|
83 |
+
$request_headers = ["X-Mock: 200"];
|
84 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->patch($request_body, null, $request_headers);
|
85 |
+
$this->assertEquals(200, $response->statusCode());
|
86 |
+
}
|
87 |
+
|
88 |
+
public function testCampaignsIdSchedulesPostMethod()
|
89 |
+
{
|
90 |
+
$request_body = json_decode('{
|
91 |
+
"send_at": 1489771528
|
92 |
+
}');
|
93 |
+
$campaign_id = "test_url_param";
|
94 |
+
$request_headers = ["X-Mock: 201"];
|
95 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->post($request_body, null, $request_headers);
|
96 |
+
$this->assertEquals(201, $response->statusCode());
|
97 |
+
}
|
98 |
+
|
99 |
+
public function testCampaignsIdSchedulesGetMethod()
|
100 |
+
{
|
101 |
+
$campaign_id = "test_url_param";
|
102 |
+
$request_headers = ["X-Mock: 200"];
|
103 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->get(null, null, $request_headers);
|
104 |
+
$this->assertEquals(200, $response->statusCode());
|
105 |
+
}
|
106 |
+
|
107 |
+
public function testCampaignsIdSchedulesDeleteMethod()
|
108 |
+
{
|
109 |
+
$campaign_id = "test_url_param";
|
110 |
+
$request_headers = ["X-Mock: 204"];
|
111 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->delete(null, null, $request_headers);
|
112 |
+
$this->assertEquals(204, $response->statusCode());
|
113 |
+
}
|
114 |
+
|
115 |
+
public function testCampaignsIdSchedulesNowPostMethod()
|
116 |
+
{
|
117 |
+
$campaign_id = "test_url_param";
|
118 |
+
$request_headers = ["X-Mock: 201"];
|
119 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->now()->post(null, null, $request_headers);
|
120 |
+
$this->assertEquals(201, $response->statusCode());
|
121 |
+
}
|
122 |
+
|
123 |
+
public function testCampaignsIdSchedulesTestPostMethod()
|
124 |
+
{
|
125 |
+
$request_body = json_decode('{
|
126 |
+
"to": "your.email@example.com"
|
127 |
+
}');
|
128 |
+
$campaign_id = "test_url_param";
|
129 |
+
$request_headers = ["X-Mock: 204"];
|
130 |
+
$response = self::$sg->client->campaigns()->_($campaign_id)->schedules()->test()
|
131 |
+
->post($request_body, null, $request_headers);
|
132 |
+
$this->assertEquals(204, $response->statusCode());
|
133 |
+
}
|
134 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Categories/CategoriesTest.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Categories;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class CategoriesTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testCategoriesGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"category": "test_string", "limit": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->categories()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testCategoriesStatsGetMethod()
|
18 |
+
{
|
19 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "categories": "test_string"}');
|
20 |
+
$request_headers = ["X-Mock: 200"];
|
21 |
+
$response = self::$sg->client->categories()->stats()->get(null, $query_params, $request_headers);
|
22 |
+
$this->assertEquals(200, $response->statusCode());
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testCategoriesStatsSumsGetMethod()
|
26 |
+
{
|
27 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}');
|
28 |
+
$request_headers = ["X-Mock: 200"];
|
29 |
+
$response = self::$sg->client->categories()->stats()->sums()->get(null, $query_params, $request_headers);
|
30 |
+
$this->assertEquals(200, $response->statusCode());
|
31 |
+
}
|
32 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Contacts/ContactDbTest.php
ADDED
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Contacts;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class ContactDbTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testContactDbCustomFieldsPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"name": "pet",
|
13 |
+
"type": "text"
|
14 |
+
}');
|
15 |
+
$request_headers = ["X-Mock: 201"];
|
16 |
+
$response = self::$sg->client->contactdb()
|
17 |
+
->custom_fields()
|
18 |
+
->post($request_body, null, $request_headers);
|
19 |
+
$this->assertEquals(201, $response->statusCode());
|
20 |
+
}
|
21 |
+
|
22 |
+
public function testContactDbCustomFieldsGetMethod()
|
23 |
+
{
|
24 |
+
$request_headers = ["X-Mock: 200"];
|
25 |
+
$response = self::$sg->client->contactdb()
|
26 |
+
->custom_fields()
|
27 |
+
->get(null, null, $request_headers);
|
28 |
+
$this->assertEquals(200, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testContactDbCustomFieldsIdGetMethod()
|
32 |
+
{
|
33 |
+
$custom_field_id = "test_url_param";
|
34 |
+
$request_headers = ["X-Mock: 200"];
|
35 |
+
$response = self::$sg->client->contactdb()
|
36 |
+
->custom_fields()
|
37 |
+
->_($custom_field_id)
|
38 |
+
->get(null, null, $request_headers);
|
39 |
+
$this->assertEquals(200, $response->statusCode());
|
40 |
+
}
|
41 |
+
|
42 |
+
public function testContactDbCustomFieldsIdDeleteMethod()
|
43 |
+
{
|
44 |
+
$custom_field_id = "test_url_param";
|
45 |
+
$request_headers = ["X-Mock: 202"];
|
46 |
+
$response = self::$sg->client->contactdb()
|
47 |
+
->custom_fields()
|
48 |
+
->_($custom_field_id)
|
49 |
+
->delete(null, null, $request_headers);
|
50 |
+
$this->assertEquals(202, $response->statusCode());
|
51 |
+
}
|
52 |
+
|
53 |
+
public function testContactDbListsPostMethod()
|
54 |
+
{
|
55 |
+
$request_body = json_decode('{
|
56 |
+
"name": "your list name"
|
57 |
+
}');
|
58 |
+
$request_headers = ["X-Mock: 201"];
|
59 |
+
$response = self::$sg->client->contactdb()
|
60 |
+
->lists()
|
61 |
+
->post($request_body, null, $request_headers);
|
62 |
+
$this->assertEquals(201, $response->statusCode());
|
63 |
+
}
|
64 |
+
|
65 |
+
public function testContactDbListsGetMethod()
|
66 |
+
{
|
67 |
+
$request_headers = ["X-Mock: 200"];
|
68 |
+
$response = self::$sg->client->contactdb()
|
69 |
+
->lists()
|
70 |
+
->get(null, null, $request_headers);
|
71 |
+
$this->assertEquals(200, $response->statusCode());
|
72 |
+
}
|
73 |
+
|
74 |
+
public function testContactDbListsDeleteMethod()
|
75 |
+
{
|
76 |
+
$request_body = json_decode('[
|
77 |
+
1,
|
78 |
+
2,
|
79 |
+
3,
|
80 |
+
4
|
81 |
+
]');
|
82 |
+
$request_headers = ["X-Mock: 204"];
|
83 |
+
$response = self::$sg->client->contactdb()
|
84 |
+
->lists()
|
85 |
+
->delete($request_body, null, $request_headers);
|
86 |
+
$this->assertEquals(204, $response->statusCode());
|
87 |
+
}
|
88 |
+
|
89 |
+
public function testContactDbListsIdPatchMethod()
|
90 |
+
{
|
91 |
+
$request_body = json_decode('{
|
92 |
+
"name": "newlistname"
|
93 |
+
}');
|
94 |
+
$query_params = json_decode('{"list_id": 1}');
|
95 |
+
$list_id = "test_url_param";
|
96 |
+
$request_headers = ["X-Mock: 200"];
|
97 |
+
$response = self::$sg->client->contactdb()
|
98 |
+
->lists()
|
99 |
+
->_($list_id)
|
100 |
+
->patch($request_body, $query_params, $request_headers);
|
101 |
+
$this->assertEquals(200, $response->statusCode());
|
102 |
+
}
|
103 |
+
|
104 |
+
public function testContactDbListsIdGetMethod()
|
105 |
+
{
|
106 |
+
$query_params = json_decode('{"list_id": 1}');
|
107 |
+
$list_id = "test_url_param";
|
108 |
+
$request_headers = ["X-Mock: 200"];
|
109 |
+
$response = self::$sg->client->contactdb()
|
110 |
+
->lists()
|
111 |
+
->_($list_id)
|
112 |
+
->get(null, $query_params, $request_headers);
|
113 |
+
$this->assertEquals(200, $response->statusCode());
|
114 |
+
}
|
115 |
+
|
116 |
+
public function testContactDbListsIdDeleteMethod()
|
117 |
+
{
|
118 |
+
$query_params = json_decode('{"delete_contacts": "true"}');
|
119 |
+
$list_id = "test_url_param";
|
120 |
+
$request_headers = ["X-Mock: 202"];
|
121 |
+
$response = self::$sg->client->contactdb()
|
122 |
+
->lists()
|
123 |
+
->_($list_id)
|
124 |
+
->delete(null, $query_params, $request_headers);
|
125 |
+
$this->assertEquals(202, $response->statusCode());
|
126 |
+
}
|
127 |
+
|
128 |
+
public function testContactDbListsIdRecipientsPostMethod()
|
129 |
+
{
|
130 |
+
$request_body = json_decode('[
|
131 |
+
"recipient_id1",
|
132 |
+
"recipient_id2"
|
133 |
+
]');
|
134 |
+
$list_id = "test_url_param";
|
135 |
+
$request_headers = ["X-Mock: 201"];
|
136 |
+
$response = self::$sg->client->contactdb()
|
137 |
+
->lists()
|
138 |
+
->_($list_id)
|
139 |
+
->recipients()
|
140 |
+
->post($request_body, null, $request_headers);
|
141 |
+
$this->assertEquals(201, $response->statusCode());
|
142 |
+
}
|
143 |
+
|
144 |
+
public function testContactDbListsIdRecipientsGetMethod()
|
145 |
+
{
|
146 |
+
$query_params = json_decode('{"page": 1, "page_size": 1, "list_id": 1}');
|
147 |
+
$list_id = "test_url_param";
|
148 |
+
$request_headers = ["X-Mock: 200"];
|
149 |
+
$response = self::$sg->client->contactdb()
|
150 |
+
->lists()
|
151 |
+
->_($list_id)
|
152 |
+
->recipients()
|
153 |
+
->get(null, $query_params, $request_headers);
|
154 |
+
$this->assertEquals(200, $response->statusCode());
|
155 |
+
}
|
156 |
+
|
157 |
+
public function testContactDbListsIdRecipientsIdPostMethod()
|
158 |
+
{
|
159 |
+
$list_id = "test_url_param";
|
160 |
+
$recipient_id = "test_url_param";
|
161 |
+
$request_headers = ["X-Mock: 201"];
|
162 |
+
$response = self::$sg->client->contactdb()
|
163 |
+
->lists()
|
164 |
+
->_($list_id)
|
165 |
+
->recipients()
|
166 |
+
->_($recipient_id)
|
167 |
+
->post(null, null, $request_headers);
|
168 |
+
$this->assertEquals(201, $response->statusCode());
|
169 |
+
}
|
170 |
+
|
171 |
+
public function testContactDbListsIdRecipientsIdDeleteMethod()
|
172 |
+
{
|
173 |
+
$query_params = json_decode('{"recipient_id": 1, "list_id": 1}');
|
174 |
+
$list_id = "test_url_param";
|
175 |
+
$recipient_id = "test_url_param";
|
176 |
+
$request_headers = ["X-Mock: 204"];
|
177 |
+
$response = self::$sg->client->contactdb()
|
178 |
+
->lists()
|
179 |
+
->_($list_id)
|
180 |
+
->recipients()
|
181 |
+
->_($recipient_id)
|
182 |
+
->delete(null, $query_params, $request_headers);
|
183 |
+
$this->assertEquals(204, $response->statusCode());
|
184 |
+
}
|
185 |
+
|
186 |
+
public function testContactDbRecipientsPatchMethod()
|
187 |
+
{
|
188 |
+
$request_body = json_decode('[
|
189 |
+
{
|
190 |
+
"email": "jones@example.com",
|
191 |
+
"first_name": "Guy",
|
192 |
+
"last_name": "Jones"
|
193 |
+
}
|
194 |
+
]');
|
195 |
+
$request_headers = ["X-Mock: 201"];
|
196 |
+
$response = self::$sg->client->contactdb()
|
197 |
+
->recipients()
|
198 |
+
->patch($request_body, null, $request_headers);
|
199 |
+
$this->assertEquals(201, $response->statusCode());
|
200 |
+
}
|
201 |
+
|
202 |
+
public function testContactDbRecipientsPostMethod()
|
203 |
+
{
|
204 |
+
$request_body = json_decode('[
|
205 |
+
{
|
206 |
+
"age": 25,
|
207 |
+
"email": "example@example.com",
|
208 |
+
"first_name": "",
|
209 |
+
"last_name": "User"
|
210 |
+
},
|
211 |
+
{
|
212 |
+
"age": 25,
|
213 |
+
"email": "example2@example.com",
|
214 |
+
"first_name": "Example",
|
215 |
+
"last_name": "User"
|
216 |
+
}
|
217 |
+
]');
|
218 |
+
$request_headers = ["X-Mock: 201"];
|
219 |
+
$response = self::$sg->client->contactdb()
|
220 |
+
->recipients()
|
221 |
+
->post($request_body, null, $request_headers);
|
222 |
+
$this->assertEquals(201, $response->statusCode());
|
223 |
+
}
|
224 |
+
|
225 |
+
public function testContactDbRecipientsGetMethod()
|
226 |
+
{
|
227 |
+
$query_params = json_decode('{"page": 1, "page_size": 1}');
|
228 |
+
$request_headers = ["X-Mock: 200"];
|
229 |
+
$response = self::$sg->client->contactdb()
|
230 |
+
->recipients()
|
231 |
+
->get(null, $query_params, $request_headers);
|
232 |
+
$this->assertEquals(200, $response->statusCode());
|
233 |
+
}
|
234 |
+
|
235 |
+
public function testContactDbRecipientsDeleteMethod()
|
236 |
+
{
|
237 |
+
$request_body = json_decode('[
|
238 |
+
"recipient_id1",
|
239 |
+
"recipient_id2"
|
240 |
+
]');
|
241 |
+
$request_headers = ["X-Mock: 200"];
|
242 |
+
$response = self::$sg->client->contactdb()
|
243 |
+
->recipients()
|
244 |
+
->delete($request_body, null, $request_headers);
|
245 |
+
$this->assertEquals(200, $response->statusCode());
|
246 |
+
}
|
247 |
+
|
248 |
+
public function testContactDbRecipientsBillableCountGetMethod()
|
249 |
+
{
|
250 |
+
$request_headers = ["X-Mock: 200"];
|
251 |
+
$response = self::$sg->client->contactdb()
|
252 |
+
->recipients()
|
253 |
+
->billable_count()
|
254 |
+
->get(null, null, $request_headers);
|
255 |
+
$this->assertEquals(200, $response->statusCode());
|
256 |
+
}
|
257 |
+
|
258 |
+
public function testContactDbRecipientsCountMethod()
|
259 |
+
{
|
260 |
+
$request_headers = ["X-Mock: 200"];
|
261 |
+
$response = self::$sg->client->contactdb()
|
262 |
+
->recipients()
|
263 |
+
->count()
|
264 |
+
->get(null, null, $request_headers);
|
265 |
+
$this->assertEquals(200, $response->statusCode());
|
266 |
+
}
|
267 |
+
|
268 |
+
public function testContactDbRecipientsSearchGetMethod()
|
269 |
+
{
|
270 |
+
$query_params = json_decode('{"{field_name}": "test_string"}');
|
271 |
+
$request_headers = ["X-Mock: 200"];
|
272 |
+
$response = self::$sg->client->contactdb()
|
273 |
+
->recipients()
|
274 |
+
->search()
|
275 |
+
->get(null, $query_params, $request_headers);
|
276 |
+
$this->assertEquals(200, $response->statusCode());
|
277 |
+
}
|
278 |
+
|
279 |
+
public function testContactDbRecipientsIdGetMethod()
|
280 |
+
{
|
281 |
+
$recipient_id = "test_url_param";
|
282 |
+
$request_headers = ["X-Mock: 200"];
|
283 |
+
$response = self::$sg->client->contactdb()
|
284 |
+
->recipients()
|
285 |
+
->_($recipient_id)
|
286 |
+
->get(null, null, $request_headers);
|
287 |
+
$this->assertEquals(200, $response->statusCode());
|
288 |
+
}
|
289 |
+
|
290 |
+
public function testContactDbRecipientsIdDeleteMethod()
|
291 |
+
{
|
292 |
+
$recipient_id = "test_url_param";
|
293 |
+
$request_headers = ["X-Mock: 204"];
|
294 |
+
$response = self::$sg->client->contactdb()
|
295 |
+
->recipients()
|
296 |
+
->_($recipient_id)
|
297 |
+
->delete(null, null, $request_headers);
|
298 |
+
$this->assertEquals(204, $response->statusCode());
|
299 |
+
}
|
300 |
+
|
301 |
+
public function testContactDbRecipientsIdListsGetMethod()
|
302 |
+
{
|
303 |
+
$recipient_id = "test_url_param";
|
304 |
+
$request_headers = ["X-Mock: 200"];
|
305 |
+
$response = self::$sg->client->contactdb()
|
306 |
+
->recipients()
|
307 |
+
->_($recipient_id)
|
308 |
+
->lists()
|
309 |
+
->get(null, null, $request_headers);
|
310 |
+
$this->assertEquals(200, $response->statusCode());
|
311 |
+
}
|
312 |
+
|
313 |
+
public function testContactDbReservedFieldsGetMethod()
|
314 |
+
{
|
315 |
+
$request_headers = ["X-Mock: 200"];
|
316 |
+
$response = self::$sg->client->contactdb()
|
317 |
+
->reserved_fields()
|
318 |
+
->get(null, null, $request_headers);
|
319 |
+
$this->assertEquals(200, $response->statusCode());
|
320 |
+
}
|
321 |
+
|
322 |
+
public function testContactDbSegmentsPostMethod()
|
323 |
+
{
|
324 |
+
$request_body = json_decode('{
|
325 |
+
"conditions": [
|
326 |
+
{
|
327 |
+
"and_or": "",
|
328 |
+
"field": "last_name",
|
329 |
+
"operator": "eq",
|
330 |
+
"value": "Miller"
|
331 |
+
},
|
332 |
+
{
|
333 |
+
"and_or": "and",
|
334 |
+
"field": "last_clicked",
|
335 |
+
"operator": "gt",
|
336 |
+
"value": "01/02/2015"
|
337 |
+
},
|
338 |
+
{
|
339 |
+
"and_or": "or",
|
340 |
+
"field": "clicks.campaign_identifier",
|
341 |
+
"operator": "eq",
|
342 |
+
"value": "513"
|
343 |
+
}
|
344 |
+
],
|
345 |
+
"list_id": 4,
|
346 |
+
"name": "Last Name Miller"
|
347 |
+
}');
|
348 |
+
$request_headers = ["X-Mock: 200"];
|
349 |
+
$response = self::$sg->client->contactdb()
|
350 |
+
->segments()
|
351 |
+
->post($request_body, null, $request_headers);
|
352 |
+
$this->assertEquals(200, $response->statusCode());
|
353 |
+
}
|
354 |
+
|
355 |
+
public function testContactDbSegmentsGetMethod()
|
356 |
+
{
|
357 |
+
$request_headers = ["X-Mock: 200"];
|
358 |
+
$response = self::$sg->client->contactdb()
|
359 |
+
->segments()
|
360 |
+
->get(null, null, $request_headers);
|
361 |
+
$this->assertEquals(200, $response->statusCode());
|
362 |
+
}
|
363 |
+
|
364 |
+
public function testContactDbSegmentsIdPatchMethod()
|
365 |
+
{
|
366 |
+
$request_body = json_decode('{
|
367 |
+
"conditions": [
|
368 |
+
{
|
369 |
+
"and_or": "",
|
370 |
+
"field": "last_name",
|
371 |
+
"operator": "eq",
|
372 |
+
"value": "Miller"
|
373 |
+
}
|
374 |
+
],
|
375 |
+
"list_id": 5,
|
376 |
+
"name": "The Millers"
|
377 |
+
}');
|
378 |
+
$query_params = json_decode('{"segment_id": "test_string"}');
|
379 |
+
$segment_id = "test_url_param";
|
380 |
+
$request_headers = ["X-Mock: 200"];
|
381 |
+
$response = self::$sg->client->contactdb()
|
382 |
+
->segments()
|
383 |
+
->_($segment_id)
|
384 |
+
->patch($request_body, $query_params, $request_headers);
|
385 |
+
$this->assertEquals(200, $response->statusCode());
|
386 |
+
}
|
387 |
+
|
388 |
+
public function testContactDbSegmentsIdGetMethod()
|
389 |
+
{
|
390 |
+
$query_params = json_decode('{"segment_id": 1}');
|
391 |
+
$segment_id = "test_url_param";
|
392 |
+
$request_headers = ["X-Mock: 200"];
|
393 |
+
$response = self::$sg->client->contactdb()
|
394 |
+
->segments()
|
395 |
+
->_($segment_id)
|
396 |
+
->get(null, $query_params, $request_headers);
|
397 |
+
$this->assertEquals(200, $response->statusCode());
|
398 |
+
}
|
399 |
+
|
400 |
+
public function testContactDbSegmentsIdDeleteMethod()
|
401 |
+
{
|
402 |
+
$query_params = json_decode('{"delete_contacts": "true"}');
|
403 |
+
$segment_id = "test_url_param";
|
404 |
+
$request_headers = ["X-Mock: 204"];
|
405 |
+
$response = self::$sg->client->contactdb()
|
406 |
+
->segments()
|
407 |
+
->_($segment_id)
|
408 |
+
->delete(null, $query_params, $request_headers);
|
409 |
+
$this->assertEquals(204, $response->statusCode());
|
410 |
+
}
|
411 |
+
|
412 |
+
public function testContactDbSegmentsIdRecipientsGetMethod()
|
413 |
+
{
|
414 |
+
$query_params = json_decode('{"page": 1, "page_size": 1}');
|
415 |
+
$segment_id = "test_url_param";
|
416 |
+
$request_headers = ["X-Mock: 200"];
|
417 |
+
$response = self::$sg->client->contactdb()
|
418 |
+
->segments()
|
419 |
+
->_($segment_id)
|
420 |
+
->recipients()
|
421 |
+
->get(null, $query_params, $request_headers);
|
422 |
+
$this->assertEquals(200, $response->statusCode());
|
423 |
+
}
|
424 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Ip/IpPoolsTest.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Ip;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class IpPoolsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testIpPoolsPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"name": "marketing"
|
13 |
+
}');
|
14 |
+
$request_headers = ["X-Mock: 200"];
|
15 |
+
$response = self::$sg->client->ips()->pools()->post($request_body, null, $request_headers);
|
16 |
+
$this->assertEquals(200, $response->statusCode());
|
17 |
+
}
|
18 |
+
|
19 |
+
public function testIpPoolsGetMethod()
|
20 |
+
{
|
21 |
+
$request_headers = ["X-Mock: 200"];
|
22 |
+
$response = self::$sg->client->ips()->pools()->get(null, null, $request_headers);
|
23 |
+
$this->assertEquals(200, $response->statusCode());
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testIpPoolsPoolNamePutMethod()
|
27 |
+
{
|
28 |
+
$request_body = json_decode('{
|
29 |
+
"name": "new_pool_name"
|
30 |
+
}');
|
31 |
+
$pool_name = "test_url_param";
|
32 |
+
$request_headers = ["X-Mock: 200"];
|
33 |
+
$response = self::$sg->client->ips()->pools()->_($pool_name)->put($request_body, null, $request_headers);
|
34 |
+
$this->assertEquals(200, $response->statusCode());
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testIpPoolsPoolNameGetMethod()
|
38 |
+
{
|
39 |
+
$pool_name = "test_url_param";
|
40 |
+
$request_headers = ["X-Mock: 200"];
|
41 |
+
$response = self::$sg->client->ips()->pools()->_($pool_name)->get(null, null, $request_headers);
|
42 |
+
$this->assertEquals(200, $response->statusCode());
|
43 |
+
}
|
44 |
+
|
45 |
+
public function testIpPoolsPoolNameDeleteMethod()
|
46 |
+
{
|
47 |
+
$pool_name = "test_url_param";
|
48 |
+
$request_headers = ["X-Mock: 204"];
|
49 |
+
$response = self::$sg->client->ips()->pools()->_($pool_name)->delete(null, null, $request_headers);
|
50 |
+
$this->assertEquals(204, $response->statusCode());
|
51 |
+
}
|
52 |
+
|
53 |
+
public function testIpPoolsPoolNameIpsPostMethod()
|
54 |
+
{
|
55 |
+
$request_body = json_decode('{
|
56 |
+
"ip": "0.0.0.0"
|
57 |
+
}');
|
58 |
+
$pool_name = "test_url_param";
|
59 |
+
$request_headers = ["X-Mock: 201"];
|
60 |
+
$response = self::$sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body, null, $request_headers);
|
61 |
+
$this->assertEquals(201, $response->statusCode());
|
62 |
+
}
|
63 |
+
|
64 |
+
public function testIpPoolsPoolNameIpsIdDeleteMethod()
|
65 |
+
{
|
66 |
+
$pool_name = "test_url_param";
|
67 |
+
$ip = "test_url_param";
|
68 |
+
$request_headers = ["X-Mock: 204"];
|
69 |
+
$response = self::$sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete(null, null, $request_headers);
|
70 |
+
$this->assertEquals(204, $response->statusCode());
|
71 |
+
}
|
72 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Ip/IpsTest.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Ip;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class IpsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testIpsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->ips()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testIpsAssignedGetMethod()
|
18 |
+
{
|
19 |
+
$request_headers = ["X-Mock: 200"];
|
20 |
+
$response = self::$sg->client->ips()->assigned()->get(null, null, $request_headers);
|
21 |
+
$this->assertEquals(200, $response->statusCode());
|
22 |
+
}
|
23 |
+
|
24 |
+
public function testIpsIpAddressGetMethod()
|
25 |
+
{
|
26 |
+
$ip_address = "test_url_param";
|
27 |
+
$request_headers = ["X-Mock: 200"];
|
28 |
+
$response = self::$sg->client->ips()->_($ip_address)->get(null, null, $request_headers);
|
29 |
+
$this->assertEquals(200, $response->statusCode());
|
30 |
+
}
|
31 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Ip/IpsWarmupTest.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Ip;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class IpsWarmupTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testIpsWarmupGetMethod()
|
10 |
+
{
|
11 |
+
$request_headers = ["X-Mock: 200"];
|
12 |
+
$response = self::$sg->client->ips()->warmup()->get(null, null, $request_headers);
|
13 |
+
$this->assertEquals(200, $response->statusCode());
|
14 |
+
}
|
15 |
+
|
16 |
+
public function testIpsWarmupPostMethod()
|
17 |
+
{
|
18 |
+
$request_body = json_decode('{
|
19 |
+
"ip": "0.0.0.0"
|
20 |
+
}');
|
21 |
+
$request_headers = ["X-Mock: 200"];
|
22 |
+
$response = self::$sg->client->ips()->warmup()->post($request_body, null, $request_headers);
|
23 |
+
$this->assertEquals(200, $response->statusCode());
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testIpsWarmupIpAddressGetMethod()
|
27 |
+
{
|
28 |
+
$ip_address = "test_url_param";
|
29 |
+
$request_headers = ["X-Mock: 200"];
|
30 |
+
$response = self::$sg->client->ips()->warmup()->_($ip_address)->get(null, null, $request_headers);
|
31 |
+
$this->assertEquals(200, $response->statusCode());
|
32 |
+
}
|
33 |
+
|
34 |
+
public function testIpsWarmupIpAddressDeleteMethod()
|
35 |
+
{
|
36 |
+
$ip_address = "test_url_param";
|
37 |
+
$request_headers = ["X-Mock: 204"];
|
38 |
+
$response = self::$sg->client->ips()->warmup()->_($ip_address)->delete(null, null, $request_headers);
|
39 |
+
$this->assertEquals(204, $response->statusCode());
|
40 |
+
}
|
41 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailBatchTest.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Mail;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class MailBatchTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testMailBatchPostMethod()
|
10 |
+
{
|
11 |
+
$request_headers = ["X-Mock: 201"];
|
12 |
+
$response = self::$sg->client->mail()->batch()->post(null, null, $request_headers);
|
13 |
+
$this->assertEquals(201, $response->statusCode());
|
14 |
+
}
|
15 |
+
|
16 |
+
public function testMailBatchIdGetMethod()
|
17 |
+
{
|
18 |
+
$batch_id = "test_url_param";
|
19 |
+
$request_headers = ["X-Mock: 200"];
|
20 |
+
$response = self::$sg->client->mail()->batch()->_($batch_id)->get(null, null, $request_headers);
|
21 |
+
$this->assertEquals(200, $response->statusCode());
|
22 |
+
}
|
23 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailSendTest.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Mail;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class MailSendTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testMailSendPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"asm": {
|
13 |
+
"group_id": 1,
|
14 |
+
"groups_to_display": [
|
15 |
+
1,
|
16 |
+
2,
|
17 |
+
3
|
18 |
+
]
|
19 |
+
},
|
20 |
+
"attachments": [
|
21 |
+
{
|
22 |
+
"content": "[BASE64 encoded content block here]",
|
23 |
+
"content_id": "ii_139db99fdb5c3704",
|
24 |
+
"disposition": "inline",
|
25 |
+
"filename": "file1.jpg",
|
26 |
+
"name": "file1",
|
27 |
+
"type": "jpg"
|
28 |
+
}
|
29 |
+
],
|
30 |
+
"batch_id": "[YOUR BATCH ID GOES HERE]",
|
31 |
+
"categories": [
|
32 |
+
"category1",
|
33 |
+
"category2"
|
34 |
+
],
|
35 |
+
"content": [
|
36 |
+
{
|
37 |
+
"type": "text/html",
|
38 |
+
"value": "<html><p>Hello, world!</p><img src=[CID GOES HERE] /></html>"
|
39 |
+
}
|
40 |
+
],
|
41 |
+
"custom_args": {
|
42 |
+
"New Argument 1": "New Value 1",
|
43 |
+
"activationAttempt": "1",
|
44 |
+
"customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
|
45 |
+
},
|
46 |
+
"from": {
|
47 |
+
"email": "sam.smith@example.com",
|
48 |
+
"name": "Sam Smith"
|
49 |
+
},
|
50 |
+
"headers": {},
|
51 |
+
"ip_pool_name": "[YOUR POOL NAME GOES HERE]",
|
52 |
+
"mail_settings": {
|
53 |
+
"bcc": {
|
54 |
+
"email": "ben.doe@example.com",
|
55 |
+
"enable": true
|
56 |
+
},
|
57 |
+
"bypass_list_management": {
|
58 |
+
"enable": true
|
59 |
+
},
|
60 |
+
"footer": {
|
61 |
+
"enable": true,
|
62 |
+
"html": "<p>Thanks</br>The Twilio SendGrid Team</p>",
|
63 |
+
"text": "Thanks,/n The Twilio SendGrid Team"
|
64 |
+
},
|
65 |
+
"sandbox_mode": {
|
66 |
+
"enable": false
|
67 |
+
},
|
68 |
+
"spam_check": {
|
69 |
+
"enable": true,
|
70 |
+
"post_to_url": "http://example.com/compliance",
|
71 |
+
"threshold": 3
|
72 |
+
}
|
73 |
+
},
|
74 |
+
"personalizations": [
|
75 |
+
{
|
76 |
+
"bcc": [
|
77 |
+
{
|
78 |
+
"email": "sam.doe@example.com",
|
79 |
+
"name": "Sam Doe"
|
80 |
+
}
|
81 |
+
],
|
82 |
+
"cc": [
|
83 |
+
{
|
84 |
+
"email": "jane.doe@example.com",
|
85 |
+
"name": "Jane Doe"
|
86 |
+
}
|
87 |
+
],
|
88 |
+
"custom_args": {
|
89 |
+
"New Argument 1": "New Value 1",
|
90 |
+
"activationAttempt": "1",
|
91 |
+
"customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
|
92 |
+
},
|
93 |
+
"headers": {
|
94 |
+
"X-Accept-Language": "en",
|
95 |
+
"X-Mailer": "MyApp"
|
96 |
+
},
|
97 |
+
"send_at": 1409348513,
|
98 |
+
"subject": "Hello, World!",
|
99 |
+
"substitutions": {
|
100 |
+
"id": "substitutions",
|
101 |
+
"type": "object"
|
102 |
+
},
|
103 |
+
"to": [
|
104 |
+
{
|
105 |
+
"email": "john.doe@example.com",
|
106 |
+
"name": "John Doe"
|
107 |
+
}
|
108 |
+
]
|
109 |
+
}
|
110 |
+
],
|
111 |
+
"reply_to": {
|
112 |
+
"email": "sam.smith@example.com",
|
113 |
+
"name": "Sam Smith"
|
114 |
+
},
|
115 |
+
"sections": {
|
116 |
+
"section": {
|
117 |
+
":sectionName1": "section 1 text",
|
118 |
+
":sectionName2": "section 2 text"
|
119 |
+
}
|
120 |
+
},
|
121 |
+
"send_at": 1409348513,
|
122 |
+
"subject": "Hello, World!",
|
123 |
+
"template_id": "[YOUR TEMPLATE ID GOES HERE]",
|
124 |
+
"tracking_settings": {
|
125 |
+
"click_tracking": {
|
126 |
+
"enable": true,
|
127 |
+
"enable_text": true
|
128 |
+
},
|
129 |
+
"ganalytics": {
|
130 |
+
"enable": true,
|
131 |
+
"utm_campaign": "[NAME OF YOUR REFERRER SOURCE]",
|
132 |
+
"utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]",
|
133 |
+
"utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]",
|
134 |
+
"utm_name": "[NAME OF YOUR CAMPAIGN]",
|
135 |
+
"utm_term": "[IDENTIFY PAID KEYWORDS HERE]"
|
136 |
+
},
|
137 |
+
"open_tracking": {
|
138 |
+
"enable": true,
|
139 |
+
"substitution_tag": "%opentrack"
|
140 |
+
},
|
141 |
+
"subscription_tracking": {
|
142 |
+
"enable": true,
|
143 |
+
"html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.",
|
144 |
+
"substitution_tag": "<%click here%>",
|
145 |
+
"text": "If you would like to unsubscribe and stop receiving these emails <% click here %>."
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}');
|
149 |
+
$request_headers = ["X-Mock: 202"];
|
150 |
+
$response = self::$sg->client->mail()->send()->post($request_body, null, $request_headers);
|
151 |
+
$this->assertEquals(202, $response->statusCode());
|
152 |
+
}
|
153 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailSettingsTest.php
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Mail;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class MailSettingsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testMailSettingsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"limit": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->mail_settings()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testMailSettingsAddressWhitelistPatchMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"enabled": true,
|
21 |
+
"list": [
|
22 |
+
"email1@example.com",
|
23 |
+
"example.com"
|
24 |
+
]
|
25 |
+
}');
|
26 |
+
$request_headers = ["X-Mock: 200"];
|
27 |
+
$response = self::$sg->client->mail_settings()->address_whitelist()->patch($request_body, null, $request_headers);
|
28 |
+
$this->assertEquals(200, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testMailSettingsAddressWhitelistGetMethod()
|
32 |
+
{
|
33 |
+
$request_headers = ["X-Mock: 200"];
|
34 |
+
$response = self::$sg->client->mail_settings()->address_whitelist()->get(null, null, $request_headers);
|
35 |
+
$this->assertEquals(200, $response->statusCode());
|
36 |
+
}
|
37 |
+
|
38 |
+
public function testMailSettingsBccPatchMethod()
|
39 |
+
{
|
40 |
+
$request_body = json_decode('{
|
41 |
+
"email": "email@example.com",
|
42 |
+
"enabled": false
|
43 |
+
}');
|
44 |
+
$request_headers = ["X-Mock: 200"];
|
45 |
+
$response = self::$sg->client->mail_settings()->bcc()->patch($request_body, null, $request_headers);
|
46 |
+
$this->assertEquals(200, $response->statusCode());
|
47 |
+
}
|
48 |
+
|
49 |
+
public function testMailSettingsBccGetMethod()
|
50 |
+
{
|
51 |
+
$request_headers = ["X-Mock: 200"];
|
52 |
+
$response = self::$sg->client->mail_settings()->bcc()->get(null, null, $request_headers);
|
53 |
+
$this->assertEquals(200, $response->statusCode());
|
54 |
+
}
|
55 |
+
|
56 |
+
public function testMailSettingsBouncePurgePatchMethod()
|
57 |
+
{
|
58 |
+
$request_body = json_decode('{
|
59 |
+
"enabled": true,
|
60 |
+
"hard_bounces": 5,
|
61 |
+
"soft_bounces": 5
|
62 |
+
}');
|
63 |
+
$request_headers = ["X-Mock: 200"];
|
64 |
+
$response = self::$sg->client->mail_settings()->bounce_purge()->patch($request_body, null, $request_headers);
|
65 |
+
$this->assertEquals(200, $response->statusCode());
|
66 |
+
}
|
67 |
+
|
68 |
+
public function testMailSettingsBouncePurgeGetMethod()
|
69 |
+
{
|
70 |
+
$request_headers = ["X-Mock: 200"];
|
71 |
+
$response = self::$sg->client->mail_settings()->bounce_purge()->get(null, null, $request_headers);
|
72 |
+
$this->assertEquals(200, $response->statusCode());
|
73 |
+
}
|
74 |
+
|
75 |
+
public function testMailSettingsFooterPatchMethod()
|
76 |
+
{
|
77 |
+
$request_body = json_decode('{
|
78 |
+
"enabled": true,
|
79 |
+
"html_content": "...",
|
80 |
+
"plain_content": "..."
|
81 |
+
}');
|
82 |
+
$request_headers = ["X-Mock: 200"];
|
83 |
+
$response = self::$sg->client->mail_settings()->footer()->patch($request_body, null, $request_headers);
|
84 |
+
$this->assertEquals(200, $response->statusCode());
|
85 |
+
}
|
86 |
+
|
87 |
+
public function testMailSettingsFooterGetMethod()
|
88 |
+
{
|
89 |
+
$request_headers = ["X-Mock: 200"];
|
90 |
+
$response = self::$sg->client->mail_settings()->footer()->get(null, null, $request_headers);
|
91 |
+
$this->assertEquals(200, $response->statusCode());
|
92 |
+
}
|
93 |
+
|
94 |
+
public function testMailSettingsForwardBouncePatchMethod()
|
95 |
+
{
|
96 |
+
$request_body = json_decode('{
|
97 |
+
"email": "example@example.com",
|
98 |
+
"enabled": true
|
99 |
+
}');
|
100 |
+
$request_headers = ["X-Mock: 200"];
|
101 |
+
$response = self::$sg->client->mail_settings()->forward_bounce()->patch($request_body, null, $request_headers);
|
102 |
+
$this->assertEquals(200, $response->statusCode());
|
103 |
+
}
|
104 |
+
|
105 |
+
public function testMailSettingsForwardBounceGetMethod()
|
106 |
+
{
|
107 |
+
$request_headers = ["X-Mock: 200"];
|
108 |
+
$response = self::$sg->client->mail_settings()->forward_bounce()->get(null, null, $request_headers);
|
109 |
+
$this->assertEquals(200, $response->statusCode());
|
110 |
+
}
|
111 |
+
|
112 |
+
public function testMailSettingsForwardSpamPatchMethod()
|
113 |
+
{
|
114 |
+
$request_body = json_decode('{
|
115 |
+
"email": "",
|
116 |
+
"enabled": false
|
117 |
+
}');
|
118 |
+
$request_headers = ["X-Mock: 200"];
|
119 |
+
$response = self::$sg->client->mail_settings()->forward_spam()->patch($request_body, null, $request_headers);
|
120 |
+
$this->assertEquals(200, $response->statusCode());
|
121 |
+
}
|
122 |
+
|
123 |
+
public function testMailSettingsForwardSpamGetMethod()
|
124 |
+
{
|
125 |
+
$request_headers = ["X-Mock: 200"];
|
126 |
+
$response = self::$sg->client->mail_settings()->forward_spam()->get(null, null, $request_headers);
|
127 |
+
$this->assertEquals(200, $response->statusCode());
|
128 |
+
}
|
129 |
+
|
130 |
+
public function testMailSettingsPlainContentPatchMethod()
|
131 |
+
{
|
132 |
+
$request_body = json_decode('{
|
133 |
+
"enabled": false
|
134 |
+
}');
|
135 |
+
$request_headers = ["X-Mock: 200"];
|
136 |
+
$response = self::$sg->client->mail_settings()->plain_content()->patch($request_body, null, $request_headers);
|
137 |
+
$this->assertEquals(200, $response->statusCode());
|
138 |
+
}
|
139 |
+
|
140 |
+
public function testMailSettingsPlainContentGetMethod()
|
141 |
+
{
|
142 |
+
$request_headers = ["X-Mock: 200"];
|
143 |
+
$response = self::$sg->client->mail_settings()->plain_content()->get(null, null, $request_headers);
|
144 |
+
$this->assertEquals(200, $response->statusCode());
|
145 |
+
}
|
146 |
+
|
147 |
+
public function testMailSettingsSpamCheckPatchMethod()
|
148 |
+
{
|
149 |
+
$request_body = json_decode('{
|
150 |
+
"enabled": true,
|
151 |
+
"max_score": 5,
|
152 |
+
"url": "url"
|
153 |
+
}');
|
154 |
+
$request_headers = ["X-Mock: 200"];
|
155 |
+
$response = self::$sg->client->mail_settings()->spam_check()->patch($request_body, null, $request_headers);
|
156 |
+
$this->assertEquals(200, $response->statusCode());
|
157 |
+
}
|
158 |
+
|
159 |
+
public function testMailSettingsSpamCheckGetMethod()
|
160 |
+
{
|
161 |
+
$request_headers = ["X-Mock: 200"];
|
162 |
+
$response = self::$sg->client->mail_settings()->spam_check()->get(null, null, $request_headers);
|
163 |
+
$this->assertEquals(200, $response->statusCode());
|
164 |
+
}
|
165 |
+
|
166 |
+
public function testMailSettingsTemplatePatchMethod()
|
167 |
+
{
|
168 |
+
$request_body = json_decode('{
|
169 |
+
"enabled": true,
|
170 |
+
"html_content": "<% body %>"
|
171 |
+
}');
|
172 |
+
$request_headers = ["X-Mock: 200"];
|
173 |
+
$response = self::$sg->client->mail_settings()->template()->patch($request_body, null, $request_headers);
|
174 |
+
$this->assertEquals(200, $response->statusCode());
|
175 |
+
}
|
176 |
+
|
177 |
+
public function testMailSettingsTemplateGetMethod()
|
178 |
+
{
|
179 |
+
$request_headers = ["X-Mock: 200"];
|
180 |
+
$response = self::$sg->client->mail_settings()->template()->get(null, null, $request_headers);
|
181 |
+
$this->assertEquals(200, $response->statusCode());
|
182 |
+
}
|
183 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Mail/MailboxProvidersTest.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Mail;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class MailboxProvidersTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testMailboxProvidersStatsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "mailbox_providers": "test_string", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->mailbox_providers()
|
14 |
+
->stats()
|
15 |
+
->get(null, $query_params, $request_headers);
|
16 |
+
$this->assertEquals(200, $response->statusCode());
|
17 |
+
}
|
18 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Scopes/ScopesTest.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Scopes;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class ScopesTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testScopesGetMethod()
|
10 |
+
{
|
11 |
+
$request_headers = ["X-Mock: 200"];
|
12 |
+
$response = self::$sg->client->scopes()->get(null, null, $request_headers);
|
13 |
+
$this->assertEquals(200, $response->statusCode());
|
14 |
+
}
|
15 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/SenderAuthentication/DomainAuthenticationTest.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Whitelabel;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class WhitelabelDomainsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testWhitelabelDomainsPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"automatic_security": false,
|
13 |
+
"custom_spf": true,
|
14 |
+
"default": true,
|
15 |
+
"domain": "example.com",
|
16 |
+
"ips": [
|
17 |
+
"192.168.1.1",
|
18 |
+
"192.168.1.2"
|
19 |
+
],
|
20 |
+
"subdomain": "news",
|
21 |
+
"username": "john@example.com"
|
22 |
+
}');
|
23 |
+
$request_headers = ["X-Mock: 201"];
|
24 |
+
$response = self::$sg->client->whitelabel()->domains()->post($request_body, null, $request_headers);
|
25 |
+
$this->assertEquals(201, $response->statusCode());
|
26 |
+
}
|
27 |
+
|
28 |
+
public function testWhitelabelDomainsGetMethod()
|
29 |
+
{
|
30 |
+
$query_params = json_decode('{"username": "test_string", "domain": "test_string", "exclude_subusers": "true", "limit": 1, "offset": 1}');
|
31 |
+
$request_headers = ["X-Mock: 200"];
|
32 |
+
$response = self::$sg->client->whitelabel()->domains()->get(null, $query_params, $request_headers);
|
33 |
+
$this->assertEquals(200, $response->statusCode());
|
34 |
+
}
|
35 |
+
|
36 |
+
public function testWhitelabelDomainsDefaultGetMethod()
|
37 |
+
{
|
38 |
+
$request_headers = ["X-Mock: 200"];
|
39 |
+
$response = self::$sg->client->whitelabel()->domains()->default()->get(null, null, $request_headers);
|
40 |
+
$this->assertEquals(200, $response->statusCode());
|
41 |
+
}
|
42 |
+
|
43 |
+
public function testWhitelabelDomainsSubUserGetMethod()
|
44 |
+
{
|
45 |
+
$request_headers = ["X-Mock: 200"];
|
46 |
+
$response = self::$sg->client->whitelabel()->domains()->subuser()->get(null, null, $request_headers);
|
47 |
+
$this->assertEquals(200, $response->statusCode());
|
48 |
+
}
|
49 |
+
|
50 |
+
public function testWhitelabelDomainsSubUserDeleteMethod()
|
51 |
+
{
|
52 |
+
$request_headers = ["X-Mock: 204"];
|
53 |
+
$response = self::$sg->client->whitelabel()->domains()->subuser()->delete(null, null, $request_headers);
|
54 |
+
$this->assertEquals(204, $response->statusCode());
|
55 |
+
}
|
56 |
+
|
57 |
+
public function testWhitelabelDomainsIdPatchMethod()
|
58 |
+
{
|
59 |
+
$request_body = json_decode('{
|
60 |
+
"custom_spf": true,
|
61 |
+
"default": false
|
62 |
+
}');
|
63 |
+
$domain_id = "test_url_param";
|
64 |
+
$request_headers = ["X-Mock: 200"];
|
65 |
+
$response = self::$sg->client->whitelabel()->domains()->_($domain_id)->patch($request_body, null, $request_headers);
|
66 |
+
$this->assertEquals(200, $response->statusCode());
|
67 |
+
}
|
68 |
+
|
69 |
+
public function testWhitelabelDomainsIdGetMethod()
|
70 |
+
{
|
71 |
+
$domain_id = "test_url_param";
|
72 |
+
$request_headers = ["X-Mock: 200"];
|
73 |
+
$response = self::$sg->client->whitelabel()->domains()->_($domain_id)->get(null, null, $request_headers);
|
74 |
+
$this->assertEquals(200, $response->statusCode());
|
75 |
+
}
|
76 |
+
|
77 |
+
public function testWhitelabelDomainsIdDeleteMethod()
|
78 |
+
{
|
79 |
+
$domain_id = "test_url_param";
|
80 |
+
$request_headers = ["X-Mock: 204"];
|
81 |
+
$response = self::$sg->client->whitelabel()->domains()->_($domain_id)->delete(null, null, $request_headers);
|
82 |
+
$this->assertEquals(204, $response->statusCode());
|
83 |
+
}
|
84 |
+
|
85 |
+
public function testWhitelabelDomainsIdSubUserPostMethod()
|
86 |
+
{
|
87 |
+
$request_body = json_decode('{
|
88 |
+
"username": "jane@example.com"
|
89 |
+
}');
|
90 |
+
$domain_id = "test_url_param";
|
91 |
+
$request_headers = ["X-Mock: 201"];
|
92 |
+
$response = self::$sg->client->whitelabel()->domains()->_($domain_id)->subuser()
|
93 |
+
->post($request_body, null, $request_headers);
|
94 |
+
$this->assertEquals(201, $response->statusCode());
|
95 |
+
}
|
96 |
+
|
97 |
+
public function testWhitelabelDomainsIdIpsPostMethod()
|
98 |
+
{
|
99 |
+
$request_body = json_decode('{
|
100 |
+
"ip": "192.168.0.1"
|
101 |
+
}');
|
102 |
+
$id = "test_url_param";
|
103 |
+
$request_headers = ["X-Mock: 200"];
|
104 |
+
$response = self::$sg->client->whitelabel()->domains()->_($id)->ips()->post($request_body, null, $request_headers);
|
105 |
+
$this->assertEquals(200, $response->statusCode());
|
106 |
+
}
|
107 |
+
|
108 |
+
public function testWhitelabelDomainsIdIpsDeleteMethod()
|
109 |
+
{
|
110 |
+
$id = "test_url_param";
|
111 |
+
$ip = "test_url_param";
|
112 |
+
$request_headers = ["X-Mock: 200"];
|
113 |
+
$response = self::$sg->client->whitelabel()->domains()->_($id)->ips()->_($ip)->delete(null, null, $request_headers);
|
114 |
+
$this->assertEquals(200, $response->statusCode());
|
115 |
+
}
|
116 |
+
|
117 |
+
public function testWhitelabelDomainsIdValidatePostMethod()
|
118 |
+
{
|
119 |
+
$id = "test_url_param";
|
120 |
+
$request_headers = ["X-Mock: 200"];
|
121 |
+
$response = self::$sg->client->whitelabel()->domains()->_($id)->validate()->post(null, null, $request_headers);
|
122 |
+
$this->assertEquals(200, $response->statusCode());
|
123 |
+
}
|
124 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/SenderAuthentication/LinkBrandingTest.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Whitelabel;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class WhitelabelLinksTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testWhitelabelLinksPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"default": true,
|
13 |
+
"domain": "example.com",
|
14 |
+
"subdomain": "mail"
|
15 |
+
}');
|
16 |
+
$query_params = json_decode('{"limit": 1, "offset": 1}');
|
17 |
+
$request_headers = ["X-Mock: 201"];
|
18 |
+
$response = self::$sg->client->whitelabel()->links()->post($request_body, $query_params, $request_headers);
|
19 |
+
$this->assertEquals(201, $response->statusCode());
|
20 |
+
}
|
21 |
+
|
22 |
+
public function testWhitelabelLinksGetMethod()
|
23 |
+
{
|
24 |
+
$query_params = json_decode('{"limit": 1}');
|
25 |
+
$request_headers = ["X-Mock: 200"];
|
26 |
+
$response = self::$sg->client->whitelabel()->links()->get(null, $query_params, $request_headers);
|
27 |
+
$this->assertEquals(200, $response->statusCode());
|
28 |
+
}
|
29 |
+
|
30 |
+
public function testWhitelabelLinksDefaultGetMethod()
|
31 |
+
{
|
32 |
+
$query_params = json_decode('{"domain": "test_string"}');
|
33 |
+
$request_headers = ["X-Mock: 200"];
|
34 |
+
$response = self::$sg->client->whitelabel()->links()->default()->get(null, $query_params, $request_headers);
|
35 |
+
$this->assertEquals(200, $response->statusCode());
|
36 |
+
}
|
37 |
+
|
38 |
+
public function testWhitelabelLinksSubUserGetMethod()
|
39 |
+
{
|
40 |
+
$query_params = json_decode('{"username": "test_string"}');
|
41 |
+
$request_headers = ["X-Mock: 200"];
|
42 |
+
$response = self::$sg->client->whitelabel()->links()->subuser()->get(null, $query_params, $request_headers);
|
43 |
+
$this->assertEquals(200, $response->statusCode());
|
44 |
+
}
|
45 |
+
|
46 |
+
public function testWhitelabelLinksSubUserDeleteMethod()
|
47 |
+
{
|
48 |
+
$query_params = json_decode('{"username": "test_string"}');
|
49 |
+
$request_headers = ["X-Mock: 204"];
|
50 |
+
$response = self::$sg->client->whitelabel()->links()->subuser()->delete(null, $query_params, $request_headers);
|
51 |
+
$this->assertEquals(204, $response->statusCode());
|
52 |
+
}
|
53 |
+
|
54 |
+
public function testWhitelabelLinksIdPatchMethod()
|
55 |
+
{
|
56 |
+
$request_body = json_decode('{
|
57 |
+
"default": true
|
58 |
+
}');
|
59 |
+
$id = "test_url_param";
|
60 |
+
$request_headers = ["X-Mock: 200"];
|
61 |
+
$response = self::$sg->client->whitelabel()->links()->_($id)->patch($request_body, null, $request_headers);
|
62 |
+
$this->assertEquals(200, $response->statusCode());
|
63 |
+
}
|
64 |
+
|
65 |
+
public function testWhitelabelLinksIdGetMethod()
|
66 |
+
{
|
67 |
+
$id = "test_url_param";
|
68 |
+
$request_headers = ["X-Mock: 200"];
|
69 |
+
$response = self::$sg->client->whitelabel()->links()->_($id)->get(null, null, $request_headers);
|
70 |
+
$this->assertEquals(200, $response->statusCode());
|
71 |
+
}
|
72 |
+
|
73 |
+
public function testWhitelabelLinksIdDeleteMethod()
|
74 |
+
{
|
75 |
+
$id = "test_url_param";
|
76 |
+
$request_headers = ["X-Mock: 204"];
|
77 |
+
$response = self::$sg->client->whitelabel()->links()->_($id)->delete(null, null, $request_headers);
|
78 |
+
$this->assertEquals(204, $response->statusCode());
|
79 |
+
}
|
80 |
+
|
81 |
+
public function testWhitelabelLinksIdValidatePostMethod()
|
82 |
+
{
|
83 |
+
$id = "test_url_param";
|
84 |
+
$request_headers = ["X-Mock: 200"];
|
85 |
+
$response = self::$sg->client->whitelabel()->links()->_($id)->validate()->post(null, null, $request_headers);
|
86 |
+
$this->assertEquals(200, $response->statusCode());
|
87 |
+
}
|
88 |
+
|
89 |
+
public function testWhitelabelLinksIdSubUserPostMethod()
|
90 |
+
{
|
91 |
+
$request_body = json_decode('{
|
92 |
+
"username": "jane@example.com"
|
93 |
+
}');
|
94 |
+
$link_id = "test_url_param";
|
95 |
+
$request_headers = ["X-Mock: 200"];
|
96 |
+
$response = self::$sg->client->whitelabel()->links()->_($link_id)->subuser()->post($request_body, null, $request_headers);
|
97 |
+
$this->assertEquals(200, $response->statusCode());
|
98 |
+
}
|
99 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/SenderAuthentication/ReverseDNSTest.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Whitelabel;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class WhitelabelIpsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testWhitelabelIpsPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"domain": "example.com",
|
13 |
+
"ip": "192.168.1.1",
|
14 |
+
"subdomain": "email"
|
15 |
+
}');
|
16 |
+
$request_headers = ["X-Mock: 201"];
|
17 |
+
$response = self::$sg->client->whitelabel()->ips()->post($request_body, null, $request_headers);
|
18 |
+
$this->assertEquals(201, $response->statusCode());
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testWhitelabelIpsGetMethod()
|
22 |
+
{
|
23 |
+
$query_params = json_decode('{"ip": "test_string", "limit": 1, "offset": 1}');
|
24 |
+
$request_headers = ["X-Mock: 200"];
|
25 |
+
$response = self::$sg->client->whitelabel()->ips()->get(null, $query_params, $request_headers);
|
26 |
+
$this->assertEquals(200, $response->statusCode());
|
27 |
+
}
|
28 |
+
|
29 |
+
public function testWhitelabelIpsIdGetMethod()
|
30 |
+
{
|
31 |
+
$id = "test_url_param";
|
32 |
+
$request_headers = ["X-Mock: 200"];
|
33 |
+
$response = self::$sg->client->whitelabel()->ips()->_($id)->get(null, null, $request_headers);
|
34 |
+
$this->assertEquals(200, $response->statusCode());
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testWhitelabelIpsIdDeleteMethod()
|
38 |
+
{
|
39 |
+
$id = "test_url_param";
|
40 |
+
$request_headers = ["X-Mock: 204"];
|
41 |
+
$response = self::$sg->client->whitelabel()->ips()->_($id)->delete(null, null, $request_headers);
|
42 |
+
$this->assertEquals(204, $response->statusCode());
|
43 |
+
}
|
44 |
+
|
45 |
+
public function testWhitelabelIpsIdValidatePostMethod()
|
46 |
+
{
|
47 |
+
$id = "test_url_param";
|
48 |
+
$request_headers = ["X-Mock: 200"];
|
49 |
+
$response = self::$sg->client->whitelabel()->ips()->_($id)->validate()->post(null, null, $request_headers);
|
50 |
+
$this->assertEquals(200, $response->statusCode());
|
51 |
+
}
|
52 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Senders/SendersTest.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Senders;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SendersTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSendersPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"address": "123 Elm St.",
|
13 |
+
"address_2": "Apt. 456",
|
14 |
+
"city": "Denver",
|
15 |
+
"country": "United States",
|
16 |
+
"from": {
|
17 |
+
"email": "from@example.com",
|
18 |
+
"name": "Example INC"
|
19 |
+
},
|
20 |
+
"nickname": "My Sender ID",
|
21 |
+
"reply_to": {
|
22 |
+
"email": "replyto@example.com",
|
23 |
+
"name": "Example INC"
|
24 |
+
},
|
25 |
+
"state": "Colorado",
|
26 |
+
"zip": "80202"
|
27 |
+
}');
|
28 |
+
$request_headers = ["X-Mock: 201"];
|
29 |
+
$response = self::$sg->client->senders()
|
30 |
+
->post($request_body, null, $request_headers);
|
31 |
+
$this->assertEquals(201, $response->statusCode());
|
32 |
+
}
|
33 |
+
|
34 |
+
public function testSendersGetMethod()
|
35 |
+
{
|
36 |
+
$request_headers = ["X-Mock: 200"];
|
37 |
+
$response = self::$sg->client->senders()
|
38 |
+
->get(null, null, $request_headers);
|
39 |
+
$this->assertEquals(200, $response->statusCode());
|
40 |
+
}
|
41 |
+
|
42 |
+
public function testSendersIdPatchMethod()
|
43 |
+
{
|
44 |
+
$request_body = json_decode('{
|
45 |
+
"address": "123 Elm St.",
|
46 |
+
"address_2": "Apt. 456",
|
47 |
+
"city": "Denver",
|
48 |
+
"country": "United States",
|
49 |
+
"from": {
|
50 |
+
"email": "from@example.com",
|
51 |
+
"name": "Example INC"
|
52 |
+
},
|
53 |
+
"nickname": "My Sender ID",
|
54 |
+
"reply_to": {
|
55 |
+
"email": "replyto@example.com",
|
56 |
+
"name": "Example INC"
|
57 |
+
},
|
58 |
+
"state": "Colorado",
|
59 |
+
"zip": "80202"
|
60 |
+
}');
|
61 |
+
$sender_id = "test_url_param";
|
62 |
+
$request_headers = ["X-Mock: 200"];
|
63 |
+
$response = self::$sg->client->senders()
|
64 |
+
->_($sender_id)
|
65 |
+
->patch($request_body, null, $request_headers);
|
66 |
+
$this->assertEquals(200, $response->statusCode());
|
67 |
+
}
|
68 |
+
|
69 |
+
public function testSendersIdGetMethod()
|
70 |
+
{
|
71 |
+
$sender_id = "test_url_param";
|
72 |
+
$request_headers = ["X-Mock: 200"];
|
73 |
+
$response = self::$sg->client->senders()
|
74 |
+
->_($sender_id)
|
75 |
+
->get(null, null, $request_headers);
|
76 |
+
$this->assertEquals(200, $response->statusCode());
|
77 |
+
}
|
78 |
+
|
79 |
+
public function testSendersIdDeleteMethod()
|
80 |
+
{
|
81 |
+
$sender_id = "test_url_param";
|
82 |
+
$request_headers = ["X-Mock: 204"];
|
83 |
+
$response = self::$sg->client->senders()
|
84 |
+
->_($sender_id)
|
85 |
+
->delete(null, null, $request_headers);
|
86 |
+
$this->assertEquals(204, $response->statusCode());
|
87 |
+
}
|
88 |
+
|
89 |
+
public function testSendersIdResendVerificationPostMethod()
|
90 |
+
{
|
91 |
+
$sender_id = "test_url_param";
|
92 |
+
$request_headers = ["X-Mock: 204"];
|
93 |
+
$response = self::$sg->client->senders()
|
94 |
+
->_($sender_id)
|
95 |
+
->resend_verification()
|
96 |
+
->post(null, null, $request_headers);
|
97 |
+
$this->assertEquals(204, $response->statusCode());
|
98 |
+
}
|
99 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Settings/AccessSettingsTest.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Settings;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class AccessSettingsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testAccessSettingsActivityGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = [
|
12 |
+
'limit' => 1
|
13 |
+
];
|
14 |
+
$request_headers = ['X-Mock: 200'];
|
15 |
+
$response = self::$sg->client->access_settings()->activity()->get(null, $query_params, $request_headers);
|
16 |
+
|
17 |
+
$this->assertEquals(200, $response->statusCode());
|
18 |
+
}
|
19 |
+
|
20 |
+
public function testAccessSettingsWhitelistPostMethod()
|
21 |
+
{
|
22 |
+
$request_body = json_decode('{
|
23 |
+
"ips": [
|
24 |
+
{
|
25 |
+
"ip": "192.168.1.1"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"ip": "192.*.*.*"
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"ip": "192.168.1.3/32"
|
32 |
+
}
|
33 |
+
]
|
34 |
+
}');
|
35 |
+
$request_headers = ["X-Mock: 201"];
|
36 |
+
$response = self::$sg->client->access_settings()->whitelist()->post($request_body, null, $request_headers);
|
37 |
+
$this->assertEquals(201, $response->statusCode());
|
38 |
+
}
|
39 |
+
|
40 |
+
public function testAccessSettingsWhitelistGetMethod()
|
41 |
+
{
|
42 |
+
$request_headers = ["X-Mock: 200"];
|
43 |
+
$response = self::$sg->client->access_settings()->whitelist()->get(null, null, $request_headers);
|
44 |
+
$this->assertEquals(200, $response->statusCode());
|
45 |
+
}
|
46 |
+
|
47 |
+
public function testAccessSettingsWhitelistDeleteMethod()
|
48 |
+
{
|
49 |
+
$request_body = json_decode('{
|
50 |
+
"ids": [
|
51 |
+
1,
|
52 |
+
2,
|
53 |
+
3
|
54 |
+
]
|
55 |
+
}');
|
56 |
+
$request_headers = ["X-Mock: 204"];
|
57 |
+
$response = self::$sg->client->access_settings()->whitelist()->delete($request_body, null, $request_headers);
|
58 |
+
$this->assertEquals(204, $response->statusCode());
|
59 |
+
}
|
60 |
+
|
61 |
+
public function testAccessSettingsWhitelistRuleIdGetMethod()
|
62 |
+
{
|
63 |
+
$rule_id = "test_url_param";
|
64 |
+
$request_headers = ["X-Mock: 200"];
|
65 |
+
$response = self::$sg->client->access_settings()->whitelist()->_($rule_id)->get(null, null, $request_headers);
|
66 |
+
$this->assertEquals(200, $response->statusCode());
|
67 |
+
}
|
68 |
+
|
69 |
+
public function testAccessSettingsWhitelistRuleIdDeleteMethod()
|
70 |
+
{
|
71 |
+
$rule_id = "test_url_param";
|
72 |
+
$request_headers = ["X-Mock: 204"];
|
73 |
+
$response = self::$sg->client->access_settings()->whitelist()->_($rule_id)->delete(null, null, $request_headers);
|
74 |
+
$this->assertEquals(204, $response->statusCode());
|
75 |
+
}
|
76 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Settings/PartnerSettingsTest.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Settings;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class PartnerSettingsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testPartnerSettingsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"limit": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->partner_settings()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testPartnerSettingsNewRelicPatchMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"enable_subuser_statistics": true,
|
21 |
+
"enabled": true,
|
22 |
+
"license_key": ""
|
23 |
+
}');
|
24 |
+
$request_headers = ["X-Mock: 200"];
|
25 |
+
$response = self::$sg->client->partner_settings()->new_relic()->patch($request_body, null, $request_headers);
|
26 |
+
$this->assertEquals(200, $response->statusCode());
|
27 |
+
}
|
28 |
+
|
29 |
+
public function testPartnerSettingsNewRelicGetMethod()
|
30 |
+
{
|
31 |
+
$request_headers = ["X-Mock: 200"];
|
32 |
+
$response = self::$sg->client->partner_settings()->new_relic()->get(null, null, $request_headers);
|
33 |
+
$this->assertEquals(200, $response->statusCode());
|
34 |
+
}
|
35 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Settings/TrackingSettingsTest.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Settings;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class TrackingSettingsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testTrackingSettingsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"limit": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->tracking_settings()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testTrackingSettingsClickPatchMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"enabled": true
|
21 |
+
}');
|
22 |
+
$request_headers = ["X-Mock: 200"];
|
23 |
+
$response = self::$sg->client->tracking_settings()->click()->patch($request_body, null, $request_headers);
|
24 |
+
$this->assertEquals(200, $response->statusCode());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testTrackingSettingsClickGetMethod()
|
28 |
+
{
|
29 |
+
$request_headers = ["X-Mock: 200"];
|
30 |
+
$response = self::$sg->client->tracking_settings()->click()->get(null, null, $request_headers);
|
31 |
+
$this->assertEquals(200, $response->statusCode());
|
32 |
+
}
|
33 |
+
|
34 |
+
public function testTrackingSettingsGoogleAnalyticsPatchMethod()
|
35 |
+
{
|
36 |
+
$request_body = json_decode('{
|
37 |
+
"enabled": true,
|
38 |
+
"utm_campaign": "website",
|
39 |
+
"utm_content": "",
|
40 |
+
"utm_medium": "email",
|
41 |
+
"utm_source": "sendgrid.com",
|
42 |
+
"utm_term": ""
|
43 |
+
}');
|
44 |
+
$request_headers = ["X-Mock: 200"];
|
45 |
+
$response = self::$sg->client->tracking_settings()->google_analytics()->patch($request_body, null, $request_headers);
|
46 |
+
$this->assertEquals(200, $response->statusCode());
|
47 |
+
}
|
48 |
+
|
49 |
+
public function testTrackingSettingsGoogleAnalyticsGetMethod()
|
50 |
+
{
|
51 |
+
$request_headers = ["X-Mock: 200"];
|
52 |
+
$response = self::$sg->client->tracking_settings()->google_analytics()->get(null, null, $request_headers);
|
53 |
+
$this->assertEquals(200, $response->statusCode());
|
54 |
+
}
|
55 |
+
|
56 |
+
public function testTrackingSettingsOpenPatchMethod()
|
57 |
+
{
|
58 |
+
$request_body = json_decode('{
|
59 |
+
"enabled": true
|
60 |
+
}');
|
61 |
+
$request_headers = ["X-Mock: 200"];
|
62 |
+
$response = self::$sg->client->tracking_settings()->open()->patch($request_body, null, $request_headers);
|
63 |
+
$this->assertEquals(200, $response->statusCode());
|
64 |
+
}
|
65 |
+
|
66 |
+
public function testTrackingSettingsOpenGetMethod()
|
67 |
+
{
|
68 |
+
$request_headers = ["X-Mock: 200"];
|
69 |
+
$response = self::$sg->client->tracking_settings()->open()->get(null, null, $request_headers);
|
70 |
+
$this->assertEquals(200, $response->statusCode());
|
71 |
+
}
|
72 |
+
|
73 |
+
public function testTrackingSettingsSubscriptionPatchMethod()
|
74 |
+
{
|
75 |
+
$request_body = json_decode('{
|
76 |
+
"enabled": true,
|
77 |
+
"html_content": "html content",
|
78 |
+
"landing": "landing page html",
|
79 |
+
"plain_content": "text content",
|
80 |
+
"replace": "replacement tag",
|
81 |
+
"url": "url"
|
82 |
+
}');
|
83 |
+
$request_headers = ["X-Mock: 200"];
|
84 |
+
$response = self::$sg->client->tracking_settings()->subscription()->patch($request_body, null, $request_headers);
|
85 |
+
$this->assertEquals(200, $response->statusCode());
|
86 |
+
}
|
87 |
+
|
88 |
+
public function testTrackingSettingsSubscriptionGetMethod()
|
89 |
+
{
|
90 |
+
$request_headers = ["X-Mock: 200"];
|
91 |
+
$response = self::$sg->client->tracking_settings()->subscription()->get(null, null, $request_headers);
|
92 |
+
$this->assertEquals(200, $response->statusCode());
|
93 |
+
}
|
94 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/BrowserStatsTest.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Stats;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class BrowserStatsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testBrowserStatsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "browsers": "test_string", "limit": "test_string", "offset": "test_string", "start_date": "2016-01-01"}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->browsers()->stats()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/ClientsStatsTest.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Stats;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class ClientsStatsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testClientsStatsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->clients()->stats()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testClientsClientTypeStatsGetMethod()
|
18 |
+
{
|
19 |
+
$query_params = json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}');
|
20 |
+
$client_type = "test_url_param";
|
21 |
+
$request_headers = ["X-Mock: 200"];
|
22 |
+
$response = self::$sg->client->clients()->_($client_type)->stats()->get(null, $query_params, $request_headers);
|
23 |
+
$this->assertEquals(200, $response->statusCode());
|
24 |
+
}
|
25 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/DevicesStatsTest.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Stats;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class DevicesStatsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testDevicesStatsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->devices()->stats()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/GeoStatsTest.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Stats;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class GeoStatsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testGeoStatsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "country": "US", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01"}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->geo()->stats()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Stats/StatsTest.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Stats;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class StatsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testStatsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->stats()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Subusers/SubUsersTest.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Subusers;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SubUsersTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSubUsersGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"username": "test_string", "limit": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->subusers()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testSubUsersPostMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"email": "John@example.com",
|
21 |
+
"ips": [
|
22 |
+
"1.1.1.1",
|
23 |
+
"2.2.2.2"
|
24 |
+
],
|
25 |
+
"password": "johns_password",
|
26 |
+
"username": "John@example.com"
|
27 |
+
}');
|
28 |
+
$request_headers = ["X-Mock: 200"];
|
29 |
+
$response = self::$sg->client->subusers()->post($request_body, null, $request_headers);
|
30 |
+
$this->assertEquals(200, $response->statusCode());
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testSubUsersReputationGetMethod()
|
34 |
+
{
|
35 |
+
$query_params = json_decode('{"usernames": "test_string"}');
|
36 |
+
$request_headers = ["X-Mock: 200"];
|
37 |
+
$response = self::$sg->client->subusers()->reputations()->get(null, $query_params, $request_headers);
|
38 |
+
$this->assertEquals(200, $response->statusCode());
|
39 |
+
}
|
40 |
+
|
41 |
+
public function testSubUsersStatsGetMethod()
|
42 |
+
{
|
43 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "offset": 1, "start_date": "2016-01-01", "subusers": "test_string"}');
|
44 |
+
$request_headers = ["X-Mock: 200"];
|
45 |
+
$response = self::$sg->client->subusers()->stats()->get(null, $query_params, $request_headers);
|
46 |
+
$this->assertEquals(200, $response->statusCode());
|
47 |
+
}
|
48 |
+
|
49 |
+
public function testSubUsersStatsMonthlyGetMethod()
|
50 |
+
{
|
51 |
+
$query_params = json_decode('{"subuser": "test_string", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "date": "test_string", "sort_by_direction": "asc"}');
|
52 |
+
$request_headers = ["X-Mock: 200"];
|
53 |
+
$response = self::$sg->client->subusers()->stats()->monthly()->get(null, $query_params, $request_headers);
|
54 |
+
$this->assertEquals(200, $response->statusCode());
|
55 |
+
}
|
56 |
+
|
57 |
+
public function testSubUsersStatsSumsGetMethod()
|
58 |
+
{
|
59 |
+
$query_params = json_decode('{"end_date": "2016-04-01", "aggregated_by": "day", "limit": 1, "sort_by_metric": "test_string", "offset": 1, "start_date": "2016-01-01", "sort_by_direction": "asc"}');
|
60 |
+
$request_headers = ["X-Mock: 200"];
|
61 |
+
$response = self::$sg->client->subusers()->stats()->sums()->get(null, $query_params, $request_headers);
|
62 |
+
$this->assertEquals(200, $response->statusCode());
|
63 |
+
}
|
64 |
+
|
65 |
+
public function testSubUsersNamePatchMethod()
|
66 |
+
{
|
67 |
+
$request_body = json_decode('{
|
68 |
+
"disabled": false
|
69 |
+
}');
|
70 |
+
$subuser_name = "test_url_param";
|
71 |
+
$request_headers = ["X-Mock: 204"];
|
72 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->patch($request_body, null, $request_headers);
|
73 |
+
$this->assertEquals(204, $response->statusCode());
|
74 |
+
}
|
75 |
+
|
76 |
+
public function testSubUsersNameDeleteMethod()
|
77 |
+
{
|
78 |
+
$subuser_name = "test_url_param";
|
79 |
+
$request_headers = ["X-Mock: 204"];
|
80 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->delete(null, null, $request_headers);
|
81 |
+
$this->assertEquals(204, $response->statusCode());
|
82 |
+
}
|
83 |
+
|
84 |
+
public function testSubUsersNameIpsPutMethod()
|
85 |
+
{
|
86 |
+
$request_body = json_decode('[
|
87 |
+
"127.0.0.1"
|
88 |
+
]');
|
89 |
+
$subuser_name = "test_url_param";
|
90 |
+
$request_headers = ["X-Mock: 200"];
|
91 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->ips()->put($request_body, null, $request_headers);
|
92 |
+
$this->assertEquals(200, $response->statusCode());
|
93 |
+
}
|
94 |
+
|
95 |
+
public function testSubUsersNameMonitorPutMethod()
|
96 |
+
{
|
97 |
+
$request_body = json_decode('{
|
98 |
+
"email": "example@example.com",
|
99 |
+
"frequency": 500
|
100 |
+
}');
|
101 |
+
$subuser_name = "test_url_param";
|
102 |
+
$request_headers = ["X-Mock: 200"];
|
103 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->monitor()->put(
|
104 |
+
$request_body,
|
105 |
+
null,
|
106 |
+
$request_headers
|
107 |
+
);
|
108 |
+
$this->assertEquals(200, $response->statusCode());
|
109 |
+
}
|
110 |
+
|
111 |
+
public function testSubUsersNameMonitorPostMethod()
|
112 |
+
{
|
113 |
+
$request_body = json_decode('{
|
114 |
+
"email": "example@example.com",
|
115 |
+
"frequency": 50000
|
116 |
+
}');
|
117 |
+
$subuser_name = "test_url_param";
|
118 |
+
$request_headers = ["X-Mock: 200"];
|
119 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->monitor()->post(
|
120 |
+
$request_body,
|
121 |
+
null,
|
122 |
+
$request_headers
|
123 |
+
);
|
124 |
+
$this->assertEquals(200, $response->statusCode());
|
125 |
+
}
|
126 |
+
|
127 |
+
public function testSubUsersNameMonitorGetMethod()
|
128 |
+
{
|
129 |
+
$subuser_name = "test_url_param";
|
130 |
+
$request_headers = ["X-Mock: 200"];
|
131 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->monitor()->get(null, null, $request_headers);
|
132 |
+
$this->assertEquals(200, $response->statusCode());
|
133 |
+
}
|
134 |
+
|
135 |
+
public function testSubUsersNameMonitorDeleteMethod()
|
136 |
+
{
|
137 |
+
$subuser_name = "test_url_param";
|
138 |
+
$request_headers = ["X-Mock: 204"];
|
139 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->monitor()->delete(null, null, $request_headers);
|
140 |
+
$this->assertEquals(204, $response->statusCode());
|
141 |
+
}
|
142 |
+
|
143 |
+
public function testSubUsersNameStatsMonthlyGetMethod()
|
144 |
+
{
|
145 |
+
$query_params = json_decode('{"date": "test_string", "sort_by_direction": "asc", "limit": 1, "sort_by_metric": "test_string", "offset": 1}');
|
146 |
+
$subuser_name = "test_url_param";
|
147 |
+
$request_headers = ["X-Mock: 200"];
|
148 |
+
$response = self::$sg->client->subusers()->_($subuser_name)->stats()->monthly()->get(
|
149 |
+
null,
|
150 |
+
$query_params,
|
151 |
+
$request_headers
|
152 |
+
);
|
153 |
+
$this->assertEquals(200, $response->statusCode());
|
154 |
+
}
|
155 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionBlocksTest.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Suppression;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SuppressionBlocksTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSuppressionBlocksGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->suppression()->blocks()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testSuppressionBlocksDeleteMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"delete_all": false,
|
21 |
+
"emails": [
|
22 |
+
"example1@example.com",
|
23 |
+
"example2@example.com"
|
24 |
+
]
|
25 |
+
}');
|
26 |
+
$request_headers = ["X-Mock: 204"];
|
27 |
+
$response = self::$sg->client->suppression()->blocks()->delete($request_body, null, $request_headers);
|
28 |
+
$this->assertEquals(204, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testSuppressionBlocksEmailGetMethod()
|
32 |
+
{
|
33 |
+
$email = "test_url_param";
|
34 |
+
$request_headers = ["X-Mock: 200"];
|
35 |
+
$response = self::$sg->client->suppression()->blocks()->_($email)->get(null, null, $request_headers);
|
36 |
+
$this->assertEquals(200, $response->statusCode());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function testSuppressionBlocksEmailDeleteMethod()
|
40 |
+
{
|
41 |
+
$email = "test_url_param";
|
42 |
+
$request_headers = ["X-Mock: 204"];
|
43 |
+
$response = self::$sg->client->suppression()->blocks()->_($email)->delete(null, null, $request_headers);
|
44 |
+
$this->assertEquals(204, $response->statusCode());
|
45 |
+
}
|
46 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionBouncesTest.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Suppression;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SuppressionBouncesTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSuppressionBouncesGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"start_time": 1, "end_time": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->suppression()->bounces()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testSuppressionBouncesDeleteMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"delete_all": true,
|
21 |
+
"emails": [
|
22 |
+
"example@example.com",
|
23 |
+
"example2@example.com"
|
24 |
+
]
|
25 |
+
}');
|
26 |
+
$request_headers = ["X-Mock: 204"];
|
27 |
+
$response = self::$sg->client->suppression()->bounces()->delete($request_body, null, $request_headers);
|
28 |
+
$this->assertEquals(204, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testSuppressionBouncesEmailGetMethod()
|
32 |
+
{
|
33 |
+
$email = "test_url_param";
|
34 |
+
$request_headers = ["X-Mock: 200"];
|
35 |
+
$response = self::$sg->client->suppression()->bounces()->_($email)->get(null, null, $request_headers);
|
36 |
+
$this->assertEquals(200, $response->statusCode());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function testSuppressionBouncesEmailDeleteMethod()
|
40 |
+
{
|
41 |
+
$query_params = json_decode('{"email_address": "example@example.com"}');
|
42 |
+
$email = "test_url_param";
|
43 |
+
$request_headers = ["X-Mock: 204"];
|
44 |
+
$response = self::$sg->client->suppression()->bounces()->_($email)->delete(null, $query_params, $request_headers);
|
45 |
+
$this->assertEquals(204, $response->statusCode());
|
46 |
+
}
|
47 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionInvalidEmailsTest.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Suppression;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SuppressionInvalidEmailsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSuppressionInvalidEmailsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->suppression()->invalid_emails()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testSuppressionInvalidEmailsDeleteMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"delete_all": false,
|
21 |
+
"emails": [
|
22 |
+
"example1@example.com",
|
23 |
+
"example2@example.com"
|
24 |
+
]
|
25 |
+
}');
|
26 |
+
$request_headers = ["X-Mock: 204"];
|
27 |
+
$response = self::$sg->client->suppression()->invalid_emails()->delete($request_body, null, $request_headers);
|
28 |
+
$this->assertEquals(204, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testSuppressionInvalidEmailsEmailGetMethod()
|
32 |
+
{
|
33 |
+
$email = "test_url_param";
|
34 |
+
$request_headers = ["X-Mock: 200"];
|
35 |
+
$response = self::$sg->client->suppression()->invalid_emails()->_($email)->get(null, null, $request_headers);
|
36 |
+
$this->assertEquals(200, $response->statusCode());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function testSuppressionBouncesEmailDeleteMethod()
|
40 |
+
{
|
41 |
+
$email = "test_url_param";
|
42 |
+
$request_headers = ["X-Mock: 204"];
|
43 |
+
$response = self::$sg->client->suppression()->invalid_emails()->_($email)->delete(null, null, $request_headers);
|
44 |
+
$this->assertEquals(204, $response->statusCode());
|
45 |
+
}
|
46 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionSpamReportsTest.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Suppression;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SuppressionSpamReportsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSuppressionSpamReportsGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->suppression()->spam_reports()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testSuppressionSpamReportsDeleteMethod()
|
18 |
+
{
|
19 |
+
$request_body = json_decode('{
|
20 |
+
"delete_all": false,
|
21 |
+
"emails": [
|
22 |
+
"example1@example.com",
|
23 |
+
"example2@example.com"
|
24 |
+
]
|
25 |
+
}');
|
26 |
+
$request_headers = ["X-Mock: 204"];
|
27 |
+
$response = self::$sg->client->suppression()->spam_reports()->delete($request_body, null, $request_headers);
|
28 |
+
$this->assertEquals(204, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testSuppressionSpamReportsEmailGetMethod()
|
32 |
+
{
|
33 |
+
$email = "test_url_param";
|
34 |
+
$request_headers = ["X-Mock: 200"];
|
35 |
+
$response = self::$sg->client->suppression()->spam_reports()->_($email)->get(null, null, $request_headers);
|
36 |
+
$this->assertEquals(200, $response->statusCode());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function testSuppressionSpamReportsEmailDeleteMethod()
|
40 |
+
{
|
41 |
+
$email = "test_url_param";
|
42 |
+
$request_headers = ["X-Mock: 204"];
|
43 |
+
$response = self::$sg->client->suppression()->spam_reports()->_($email)->delete(null, null, $request_headers);
|
44 |
+
$this->assertEquals(204, $response->statusCode());
|
45 |
+
}
|
46 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Suppression/SuppressionUnsubscribesTest.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Suppression;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class SuppressionUnsubscribesTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testSuppressionUnsubscribesGetMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"start_time": 1, "limit": 1, "end_time": 1, "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->suppression()->unsubscribes()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Templates/TemplatesTest.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Templates;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class TemplatesTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testTemplatesPostMethod()
|
10 |
+
{
|
11 |
+
$request_body = json_decode('{
|
12 |
+
"name": "example_name"
|
13 |
+
}');
|
14 |
+
$request_headers = ["X-Mock: 201"];
|
15 |
+
$response = self::$sg->client->templates()->post($request_body, null, $request_headers);
|
16 |
+
$this->assertEquals(201, $response->statusCode());
|
17 |
+
}
|
18 |
+
|
19 |
+
public function testTemplatesGetMethod()
|
20 |
+
{
|
21 |
+
$request_headers = ["X-Mock: 200"];
|
22 |
+
$response = self::$sg->client->templates()->get(null, null, $request_headers);
|
23 |
+
$this->assertEquals(200, $response->statusCode());
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testTemplatesIdPatchMethod()
|
27 |
+
{
|
28 |
+
$request_body = json_decode('{
|
29 |
+
"name": "new_example_name"
|
30 |
+
}');
|
31 |
+
$template_id = "test_url_param";
|
32 |
+
$request_headers = ["X-Mock: 200"];
|
33 |
+
$response = self::$sg->client->templates()->_($template_id)->patch($request_body, null, $request_headers);
|
34 |
+
$this->assertEquals(200, $response->statusCode());
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testTemplatesIdGetMethod()
|
38 |
+
{
|
39 |
+
$template_id = "test_url_param";
|
40 |
+
$request_headers = ["X-Mock: 200"];
|
41 |
+
$response = self::$sg->client->templates()->_($template_id)->get(null, null, $request_headers);
|
42 |
+
$this->assertEquals(200, $response->statusCode());
|
43 |
+
}
|
44 |
+
|
45 |
+
public function testTemplatesIdDeleteMethod()
|
46 |
+
{
|
47 |
+
$template_id = "test_url_param";
|
48 |
+
$request_headers = ["X-Mock: 204"];
|
49 |
+
$response = self::$sg->client->templates()->_($template_id)->delete(null, null, $request_headers);
|
50 |
+
$this->assertEquals(204, $response->statusCode());
|
51 |
+
}
|
52 |
+
|
53 |
+
public function testTemplatesIdVersionsPostMethod()
|
54 |
+
{
|
55 |
+
$request_body = json_decode('{
|
56 |
+
"active": 1,
|
57 |
+
"html_content": "<%body%>",
|
58 |
+
"name": "example_version_name",
|
59 |
+
"plain_content": "<%body%>",
|
60 |
+
"subject": "<%subject%>",
|
61 |
+
"template_id": "ddb96bbc-9b92-425e-8979-99464621b543"
|
62 |
+
}');
|
63 |
+
$template_id = "test_url_param";
|
64 |
+
$request_headers = ["X-Mock: 201"];
|
65 |
+
$response = self::$sg->client->templates()->_($template_id)->versions()->post($request_body, null, $request_headers);
|
66 |
+
$this->assertEquals(201, $response->statusCode());
|
67 |
+
}
|
68 |
+
|
69 |
+
public function testTemplatesIdVersionsIdPatchMethod()
|
70 |
+
{
|
71 |
+
$request_body = json_decode('{
|
72 |
+
"active": 1,
|
73 |
+
"html_content": "<%body%>",
|
74 |
+
"name": "updated_example_name",
|
75 |
+
"plain_content": "<%body%>",
|
76 |
+
"subject": "<%subject%>"
|
77 |
+
}');
|
78 |
+
$template_id = "test_url_param";
|
79 |
+
$version_id = "test_url_param";
|
80 |
+
$request_headers = ["X-Mock: 200"];
|
81 |
+
$response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)
|
82 |
+
->patch($request_body, null, $request_headers);
|
83 |
+
$this->assertEquals(200, $response->statusCode());
|
84 |
+
}
|
85 |
+
|
86 |
+
public function testTemplatesIdVersionsIdGetMethod()
|
87 |
+
{
|
88 |
+
$template_id = "test_url_param";
|
89 |
+
$version_id = "test_url_param";
|
90 |
+
$request_headers = ["X-Mock: 200"];
|
91 |
+
$response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->get(null, null, $request_headers);
|
92 |
+
$this->assertEquals(200, $response->statusCode());
|
93 |
+
}
|
94 |
+
|
95 |
+
public function testTemplatesIdVersionsIdDeleteMethod()
|
96 |
+
{
|
97 |
+
$template_id = "test_url_param";
|
98 |
+
$version_id = "test_url_param";
|
99 |
+
$request_headers = ["X-Mock: 204"];
|
100 |
+
$response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)
|
101 |
+
->delete(null, null, $request_headers);
|
102 |
+
$this->assertEquals(204, $response->statusCode());
|
103 |
+
}
|
104 |
+
|
105 |
+
public function testTemplatesIdVersionsIdActivatePostMethod()
|
106 |
+
{
|
107 |
+
$template_id = "test_url_param";
|
108 |
+
$version_id = "test_url_param";
|
109 |
+
$request_headers = ["X-Mock: 200"];
|
110 |
+
$response = self::$sg->client->templates()->_($template_id)->versions()->_($version_id)->activate()
|
111 |
+
->post(null, null, $request_headers);
|
112 |
+
$this->assertEquals(200, $response->statusCode());
|
113 |
+
}
|
114 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/Users/UserTest.php
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests\Users;
|
4 |
+
|
5 |
+
use SendGrid\Tests\BaseTestClass;
|
6 |
+
|
7 |
+
class UserTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
public function testUserMethod()
|
10 |
+
{
|
11 |
+
$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}');
|
12 |
+
$request_headers = ["X-Mock: 200"];
|
13 |
+
$response = self::$sg->client->stats()->get(null, $query_params, $request_headers);
|
14 |
+
$this->assertEquals(200, $response->statusCode());
|
15 |
+
}
|
16 |
+
|
17 |
+
public function testUserAccountGetMethod()
|
18 |
+
{
|
19 |
+
$request_headers = ["X-Mock: 200"];
|
20 |
+
$response = self::$sg->client->user()->account()->get(null, null, $request_headers);
|
21 |
+
$this->assertEquals(200, $response->statusCode());
|
22 |
+
}
|
23 |
+
|
24 |
+
public function testUserCreditsGetMethod()
|
25 |
+
{
|
26 |
+
$request_headers = ["X-Mock: 200"];
|
27 |
+
$response = self::$sg->client->user()->credits()->get(null, null, $request_headers);
|
28 |
+
$this->assertEquals(200, $response->statusCode());
|
29 |
+
}
|
30 |
+
|
31 |
+
public function testUserEmailPutMethod()
|
32 |
+
{
|
33 |
+
$request_body = json_decode('{
|
34 |
+
"email": "example@example.com"
|
35 |
+
}');
|
36 |
+
$request_headers = ["X-Mock: 200"];
|
37 |
+
$response = self::$sg->client->user()->email()->put($request_body, null, $request_headers);
|
38 |
+
$this->assertEquals(200, $response->statusCode());
|
39 |
+
}
|
40 |
+
|
41 |
+
public function testUserEmailGetMethod()
|
42 |
+
{
|
43 |
+
$request_headers = ["X-Mock: 200"];
|
44 |
+
$response = self::$sg->client->user()->email()->get(null, null, $request_headers);
|
45 |
+
$this->assertEquals(200, $response->statusCode());
|
46 |
+
}
|
47 |
+
|
48 |
+
public function testUserPasswordPutMethod()
|
49 |
+
{
|
50 |
+
$request_body = json_decode('{
|
51 |
+
"new_password": "new_password",
|
52 |
+
"old_password": "old_password"
|
53 |
+
}');
|
54 |
+
$request_headers = ["X-Mock: 200"];
|
55 |
+
$response = self::$sg->client->user()->password()->put($request_body, null, $request_headers);
|
56 |
+
$this->assertEquals(200, $response->statusCode());
|
57 |
+
}
|
58 |
+
|
59 |
+
public function testUserProfilePatchMethod()
|
60 |
+
{
|
61 |
+
$request_body = json_decode('{
|
62 |
+
"city": "Orange",
|
63 |
+
"first_name": "Example",
|
64 |
+
"last_name": "User"
|
65 |
+
}');
|
66 |
+
$request_headers = ["X-Mock: 200"];
|
67 |
+
$response = self::$sg->client->user()->profile()->patch($request_body, null, $request_headers);
|
68 |
+
$this->assertEquals(200, $response->statusCode());
|
69 |
+
}
|
70 |
+
|
71 |
+
public function testUserProfileGetMethod()
|
72 |
+
{
|
73 |
+
$request_headers = ["X-Mock: 200"];
|
74 |
+
$response = self::$sg->client->user()->profile()->get(null, null, $request_headers);
|
75 |
+
$this->assertEquals($response->statusCode(), 200);
|
76 |
+
}
|
77 |
+
|
78 |
+
public function testUserScheduledSendsPostMethod()
|
79 |
+
{
|
80 |
+
$request_body = json_decode('{
|
81 |
+
"batch_id": "YOUR_BATCH_ID",
|
82 |
+
"status": "pause"
|
83 |
+
}');
|
84 |
+
$request_headers = ["X-Mock: 201"];
|
85 |
+
$response = self::$sg->client->user()->scheduled_sends()->post($request_body, null, $request_headers);
|
86 |
+
$this->assertEquals(201, $response->statusCode());
|
87 |
+
}
|
88 |
+
|
89 |
+
public function testUserScheduledSendsGetMethod()
|
90 |
+
{
|
91 |
+
$request_headers = ["X-Mock: 200"];
|
92 |
+
$response = self::$sg->client->user()->scheduled_sends()->get(null, null, $request_headers);
|
93 |
+
$this->assertEquals(200, $response->statusCode());
|
94 |
+
}
|
95 |
+
|
96 |
+
public function testUserScheduledSendsBatchIdPatchMethod()
|
97 |
+
{
|
98 |
+
$request_body = json_decode('{
|
99 |
+
"status": "pause"
|
100 |
+
}');
|
101 |
+
$batch_id = "test_url_param";
|
102 |
+
$request_headers = ["X-Mock: 204"];
|
103 |
+
$response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->patch(
|
104 |
+
$request_body,
|
105 |
+
null,
|
106 |
+
$request_headers
|
107 |
+
);
|
108 |
+
$this->assertEquals(204, $response->statusCode());
|
109 |
+
}
|
110 |
+
|
111 |
+
public function testUserScheduledSendsBatchIdGetMethod()
|
112 |
+
{
|
113 |
+
$batch_id = "test_url_param";
|
114 |
+
$request_headers = ["X-Mock: 200"];
|
115 |
+
$response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->get(null, null, $request_headers);
|
116 |
+
$this->assertEquals(200, $response->statusCode());
|
117 |
+
}
|
118 |
+
|
119 |
+
public function testUserScheduledSendsBatchIdDeleteMethod()
|
120 |
+
{
|
121 |
+
$batch_id = "test_url_param";
|
122 |
+
$request_headers = ["X-Mock: 204"];
|
123 |
+
$response = self::$sg->client->user()->scheduled_sends()->_($batch_id)->delete(null, null, $request_headers);
|
124 |
+
$this->assertEquals(204, $response->statusCode());
|
125 |
+
}
|
126 |
+
|
127 |
+
public function testUserSettingsEnforcedTlsPatchMethod()
|
128 |
+
{
|
129 |
+
$request_body = json_decode('{
|
130 |
+
"require_tls": true,
|
131 |
+
"require_valid_cert": false
|
132 |
+
}');
|
133 |
+
$request_headers = ["X-Mock: 200"];
|
134 |
+
$response = self::$sg->client->user()->settings()->enforced_tls()->patch($request_body, null, $request_headers);
|
135 |
+
$this->assertEquals(200, $response->statusCode());
|
136 |
+
}
|
137 |
+
|
138 |
+
public function testUserSettingsEnforcedTlsGetMethod()
|
139 |
+
{
|
140 |
+
$request_headers = ["X-Mock: 200"];
|
141 |
+
$response = self::$sg->client->user()->settings()->enforced_tls()->get(null, null, $request_headers);
|
142 |
+
$this->assertEquals(200, $response->statusCode());
|
143 |
+
}
|
144 |
+
|
145 |
+
public function testUserUsernamePutMethod()
|
146 |
+
{
|
147 |
+
$request_body = json_decode('{
|
148 |
+
"username": "test_username"
|
149 |
+
}');
|
150 |
+
$request_headers = ["X-Mock: 200"];
|
151 |
+
$response = self::$sg->client->user()->username()->put($request_body, null, $request_headers);
|
152 |
+
$this->assertEquals(200, $response->statusCode());
|
153 |
+
}
|
154 |
+
|
155 |
+
public function testUserUsernameGetMethod()
|
156 |
+
{
|
157 |
+
$request_headers = ["X-Mock: 200"];
|
158 |
+
$response = self::$sg->client->user()->username()->get(null, null, $request_headers);
|
159 |
+
$this->assertEquals(200, $response->statusCode());
|
160 |
+
}
|
161 |
+
|
162 |
+
public function testUserWebhooksEventSettingsPatchMethod()
|
163 |
+
{
|
164 |
+
$request_body = json_decode('{
|
165 |
+
"bounce": true,
|
166 |
+
"click": true,
|
167 |
+
"deferred": true,
|
168 |
+
"delivered": true,
|
169 |
+
"dropped": true,
|
170 |
+
"enabled": true,
|
171 |
+
"group_resubscribe": true,
|
172 |
+
"group_unsubscribe": true,
|
173 |
+
"open": true,
|
174 |
+
"processed": true,
|
175 |
+
"spam_report": true,
|
176 |
+
"unsubscribe": true,
|
177 |
+
"url": "url"
|
178 |
+
}');
|
179 |
+
$request_headers = ["X-Mock: 200"];
|
180 |
+
$response = self::$sg->client->user()->webhooks()->event()->settings()->patch(
|
181 |
+
$request_body,
|
182 |
+
null,
|
183 |
+
$request_headers
|
184 |
+
);
|
185 |
+
$this->assertEquals(200, $response->statusCode());
|
186 |
+
}
|
187 |
+
|
188 |
+
public function testUserWebhooksEventSettingsGetMethod()
|
189 |
+
{
|
190 |
+
$request_headers = ["X-Mock: 200"];
|
191 |
+
$response = self::$sg->client->user()->webhooks()->event()->settings()->get(null, null, $request_headers);
|
192 |
+
$this->assertEquals(200, $response->statusCode());
|
193 |
+
}
|
194 |
+
|
195 |
+
public function testUserWebhooksEventTestPostMethod()
|
196 |
+
{
|
197 |
+
$request_body = json_decode('{
|
198 |
+
"url": "url"
|
199 |
+
}');
|
200 |
+
$request_headers = ["X-Mock: 204"];
|
201 |
+
$response = self::$sg->client->user()->webhooks()->event()->test()->post($request_body, null, $request_headers);
|
202 |
+
$this->assertEquals(204, $response->statusCode());
|
203 |
+
}
|
204 |
+
|
205 |
+
public function testUserWebhooksParseSettingsPostMethod()
|
206 |
+
{
|
207 |
+
$request_body = json_decode('{
|
208 |
+
"hostname": "myhostname.com",
|
209 |
+
"send_raw": false,
|
210 |
+
"spam_check": true,
|
211 |
+
"url": "http://email.myhosthame.com"
|
212 |
+
}');
|
213 |
+
$request_headers = ["X-Mock: 201"];
|
214 |
+
$response = self::$sg->client->user()->webhooks()->parse()->settings()->post(
|
215 |
+
$request_body,
|
216 |
+
null,
|
217 |
+
$request_headers
|
218 |
+
);
|
219 |
+
$this->assertEquals(201, $response->statusCode());
|
220 |
+
}
|
221 |
+
|
222 |
+
public function testUserWebhooksParseSettingsGetMethod()
|
223 |
+
{
|
224 |
+
$request_headers = ["X-Mock: 200"];
|
225 |
+
$response = self::$sg->client->user()->webhooks()->parse()->settings()->get(null, null, $request_headers);
|
226 |
+
$this->assertEquals(200, $response->statusCode());
|
227 |
+
}
|
228 |
+
|
229 |
+
public function testUserWebhooksParseHostnamePatchMethod()
|
230 |
+
{
|
231 |
+
$request_body = json_decode('{
|
232 |
+
"send_raw": true,
|
233 |
+
"spam_check": false,
|
234 |
+
"url": "http://newdomain.com/parse"
|
235 |
+
}');
|
236 |
+
$hostname = "test_url_param";
|
237 |
+
$request_headers = ["X-Mock: 200"];
|
238 |
+
$response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)
|
239 |
+
->patch($request_body, null, $request_headers);
|
240 |
+
$this->assertEquals(200, $response->statusCode());
|
241 |
+
}
|
242 |
+
|
243 |
+
public function testUserWebhooksParseHostnameGetMethod()
|
244 |
+
{
|
245 |
+
$hostname = "test_url_param";
|
246 |
+
$request_headers = ["X-Mock: 200"];
|
247 |
+
$response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->get(
|
248 |
+
null,
|
249 |
+
null,
|
250 |
+
$request_headers
|
251 |
+
);
|
252 |
+
$this->assertEquals(200, $response->statusCode());
|
253 |
+
}
|
254 |
+
|
255 |
+
public function testUserWebhooksParseHostnameDeleteMethod()
|
256 |
+
{
|
257 |
+
$hostname = "test_url_param";
|
258 |
+
$request_headers = ["X-Mock: 204"];
|
259 |
+
$response = self::$sg->client->user()->webhooks()->parse()->settings()->_($hostname)->delete(
|
260 |
+
null,
|
261 |
+
null,
|
262 |
+
$request_headers
|
263 |
+
);
|
264 |
+
$this->assertEquals(204, $response->statusCode());
|
265 |
+
}
|
266 |
+
|
267 |
+
public function testUserWebhooksParseStatsGetMethod()
|
268 |
+
{
|
269 |
+
$query_params = json_decode('{"aggregated_by": "day", "limit": "test_string", "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": "test_string"}');
|
270 |
+
$request_headers = ["X-Mock: 200"];
|
271 |
+
$response = self::$sg->client->user()->webhooks()->parse()->stats()->get(null, $query_params, $request_headers);
|
272 |
+
$this->assertEquals(200, $response->statusCode());
|
273 |
+
}
|
274 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/helpers/contacts/RecipientsTest.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace SendGrid\Tests;
|
3 |
+
|
4 |
+
use SendGrid\Tests\BaseTestClass;
|
5 |
+
use SendGrid\Contacts\RecipientForm;
|
6 |
+
use SendGrid\Contacts\Recipient;
|
7 |
+
|
8 |
+
class RecipientsTestRecipient extends BaseTestClass
|
9 |
+
{
|
10 |
+
public function testRecipientsForm()
|
11 |
+
{
|
12 |
+
$form = (string) new RecipientForm('http://www.example.com/recipientFormSubmit');
|
13 |
+
$this->assertEquals(
|
14 |
+
$form, '<form action="http://www.example.com/recipientFormSubmit" method="post">
|
15 |
+
First Name: <input type="text" name="first-name"><br>
|
16 |
+
Last Name: <input type="text" name="last-name"><br>
|
17 |
+
E-mail: <input type="text" name="email"><br>
|
18 |
+
<input type="submit">
|
19 |
+
</form>'
|
20 |
+
);
|
21 |
+
}
|
22 |
+
public function testRecipientsFormSubmit()
|
23 |
+
{
|
24 |
+
$firstName = 'Test';
|
25 |
+
$lastName = 'Tester';
|
26 |
+
$email = 'test@test.com';
|
27 |
+
$recipient = new Recipient($firstName, $lastName, $email);
|
28 |
+
$json = json_encode($recipient);
|
29 |
+
$this->assertEquals($json, '{"email":"test@test.com","first_name":"Test","last_name":"Tester"}');
|
30 |
+
}
|
31 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/integration/helpers/stats/StatsTest.php
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace SendGrid\Tests;
|
3 |
+
|
4 |
+
use SendGrid\Tests\BaseTestClass;
|
5 |
+
use SendGrid\Stats\Stats;
|
6 |
+
|
7 |
+
class StatsTest extends BaseTestClass
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* @param array $expectedGlobal
|
11 |
+
* @param array $expectedCategory
|
12 |
+
* @param array $expectedSubuser
|
13 |
+
* @param array $expectedSum
|
14 |
+
* @param array $expectedSubuserMonthly
|
15 |
+
* @dataProvider validValues
|
16 |
+
*/
|
17 |
+
public function testGetValues(
|
18 |
+
$expectedGlobal,
|
19 |
+
$expectedCategory,
|
20 |
+
$expectedSubuser,
|
21 |
+
$expectedSum,
|
22 |
+
$expectedSubuserMonthly
|
23 |
+
) {
|
24 |
+
$userStats = new Stats($expectedGlobal['start_date'], $expectedGlobal['end_date'], $expectedGlobal['aggregated_by']);
|
25 |
+
$this->assertEquals($expectedGlobal, $userStats->getGlobal());
|
26 |
+
$this->assertEquals($expectedCategory, $userStats->getCategory($expectedCategory['categories']));
|
27 |
+
$this->assertEquals($expectedSubuser, $userStats->getSubuser($expectedSubuser['subusers']));
|
28 |
+
$this->assertEquals($expectedSum, $userStats->getSum(
|
29 |
+
$expectedSum['sort_by_metric'],
|
30 |
+
$expectedSum['sort_by_direction'],
|
31 |
+
$expectedSum['limit'],
|
32 |
+
$expectedSum['offset']
|
33 |
+
));
|
34 |
+
$this->assertEquals($expectedSubuserMonthly, $userStats->getSubuserMonthly(
|
35 |
+
$expectedSubuserMonthly['subuser'],
|
36 |
+
$expectedSubuserMonthly['sort_by_metric'],
|
37 |
+
$expectedSubuserMonthly['sort_by_direction'],
|
38 |
+
$expectedSubuserMonthly['limit'],
|
39 |
+
$expectedSubuserMonthly['offset']
|
40 |
+
));
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param array $expectedGlobal
|
45 |
+
* @param array $expectedCategory
|
46 |
+
* @param array $expectedSubuser
|
47 |
+
* @param array $expectedSum
|
48 |
+
* @param array $expectedSubuserMonthly
|
49 |
+
* @dataProvider invalidValues
|
50 |
+
* @expectedException Exception
|
51 |
+
*/
|
52 |
+
public function testGetValuesFail(
|
53 |
+
$expectedGlobal,
|
54 |
+
$expectedCategory,
|
55 |
+
$expectedSubuser,
|
56 |
+
$expectedSum,
|
57 |
+
$expectedSubuserMonthly
|
58 |
+
) {
|
59 |
+
$this->testGetValues(
|
60 |
+
$expectedGlobal,
|
61 |
+
$expectedCategory,
|
62 |
+
$expectedSubuser,
|
63 |
+
$expectedSum,
|
64 |
+
$expectedSubuserMonthly
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
public function validValues()
|
69 |
+
{
|
70 |
+
return [
|
71 |
+
[
|
72 |
+
$this->getExpectedGlobal('1980-01-01', null, null),
|
73 |
+
$this->getExpectedCategory('1980-01-01', null, null, ['cat1', 'cat2']),
|
74 |
+
$this->getExpectedSubuser('1980-01-01', null, null, ['user1', 'user2']),
|
75 |
+
$this->getExpectedSum('1980-01-01', null, null, 'delivered', 'desc', 5, 0),
|
76 |
+
$this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'desc', 5, 0),
|
77 |
+
],
|
78 |
+
[
|
79 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', null),
|
80 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', null, ['cat1']),
|
81 |
+
$this->getExpectedSubuser('1980-01-01', '2017-01-01', null, ['user1']),
|
82 |
+
$this->getExpectedSum('1980-01-01', '2017-01-01', null, 'delivered', 'asc', 10, 2),
|
83 |
+
$this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'asc', 10, 2),
|
84 |
+
],
|
85 |
+
[
|
86 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
87 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']),
|
88 |
+
$this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', ['user1']),
|
89 |
+
$this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asc', 50, 6),
|
90 |
+
$this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'asc', 50, 6),
|
91 |
+
],
|
92 |
+
];
|
93 |
+
}
|
94 |
+
|
95 |
+
public function invalidValues()
|
96 |
+
{
|
97 |
+
return [
|
98 |
+
[
|
99 |
+
$this->getExpectedGlobal(null, null, null),
|
100 |
+
null,
|
101 |
+
null,
|
102 |
+
null,
|
103 |
+
null
|
104 |
+
],
|
105 |
+
[
|
106 |
+
$this->getExpectedGlobal('1980-01-0145', null, null),
|
107 |
+
null,
|
108 |
+
null,
|
109 |
+
null,
|
110 |
+
null
|
111 |
+
],
|
112 |
+
[
|
113 |
+
$this->getExpectedGlobal('1980-01-01', '1980-01-0145', null),
|
114 |
+
null,
|
115 |
+
null,
|
116 |
+
null,
|
117 |
+
null
|
118 |
+
],
|
119 |
+
[
|
120 |
+
$this->getExpectedGlobal('1980-01-01', '1980-01-02', 'asdf'),
|
121 |
+
null,
|
122 |
+
null,
|
123 |
+
null,
|
124 |
+
null
|
125 |
+
],
|
126 |
+
[
|
127 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
128 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', null),
|
129 |
+
null,
|
130 |
+
null,
|
131 |
+
null
|
132 |
+
],
|
133 |
+
[
|
134 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
135 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', null),
|
136 |
+
null,
|
137 |
+
null,
|
138 |
+
null
|
139 |
+
],
|
140 |
+
[
|
141 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
142 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', []),
|
143 |
+
null,
|
144 |
+
null,
|
145 |
+
null
|
146 |
+
],
|
147 |
+
[
|
148 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
149 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['a' => 'b']),
|
150 |
+
null,
|
151 |
+
null,
|
152 |
+
null
|
153 |
+
],
|
154 |
+
[
|
155 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
156 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']),
|
157 |
+
$this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', null),
|
158 |
+
$this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', null, 50, 6),
|
159 |
+
null
|
160 |
+
],
|
161 |
+
[
|
162 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
163 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']),
|
164 |
+
$this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', null),
|
165 |
+
$this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asdf', 50, 6),
|
166 |
+
null
|
167 |
+
],
|
168 |
+
[
|
169 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
170 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']),
|
171 |
+
$this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', null),
|
172 |
+
$this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asc', null, 'asdf'),
|
173 |
+
null
|
174 |
+
],
|
175 |
+
[
|
176 |
+
$this->getExpectedGlobal('1980-01-01', '2017-01-01', 'day'),
|
177 |
+
$this->getExpectedCategory('1980-01-01', '2017-01-01', 'day', ['cat1']),
|
178 |
+
$this->getExpectedSubuser('1980-01-01', '2017-01-01', 'day', ['user1']),
|
179 |
+
$this->getExpectedSum('1980-01-01', '2017-01-01', 'day', 'delivered', 'asc', 50, 6),
|
180 |
+
$this->getExpectedSubuserMonthly('1980-01-01', 'user1', 'delivered', 'asc', 50, null),
|
181 |
+
],
|
182 |
+
];
|
183 |
+
}
|
184 |
+
|
185 |
+
public function getExpectedGlobal($startDate, $endDate, $aggregatedBy)
|
186 |
+
{
|
187 |
+
return [
|
188 |
+
'start_date' => $startDate,
|
189 |
+
'end_date' => $endDate,
|
190 |
+
'aggregated_by' => $aggregatedBy,
|
191 |
+
];
|
192 |
+
}
|
193 |
+
|
194 |
+
public function getExpectedCategory($startDate, $endDate, $aggregatedBy, $categories)
|
195 |
+
{
|
196 |
+
return [
|
197 |
+
'start_date' => $startDate,
|
198 |
+
'end_date' => $endDate,
|
199 |
+
'aggregated_by' => $aggregatedBy,
|
200 |
+
'categories' => $categories
|
201 |
+
];
|
202 |
+
}
|
203 |
+
|
204 |
+
public function getExpectedSubuser($startDate, $endDate, $aggregatedBy, $subusers)
|
205 |
+
{
|
206 |
+
return [
|
207 |
+
'start_date' => $startDate,
|
208 |
+
'end_date' => $endDate,
|
209 |
+
'aggregated_by' => $aggregatedBy,
|
210 |
+
'subusers' => $subusers
|
211 |
+
];
|
212 |
+
}
|
213 |
+
|
214 |
+
public function getExpectedSum($startDate, $endDate, $aggregatedBy, $sortByMetric, $sortByDirection, $limit, $offset)
|
215 |
+
{
|
216 |
+
return [
|
217 |
+
'start_date' => $startDate,
|
218 |
+
'end_date' => $endDate,
|
219 |
+
'aggregated_by' => $aggregatedBy,
|
220 |
+
'sort_by_metric' => $sortByMetric,
|
221 |
+
'sort_by_direction' => $sortByDirection,
|
222 |
+
'limit' => $limit,
|
223 |
+
'offset' => $offset
|
224 |
+
];
|
225 |
+
}
|
226 |
+
|
227 |
+
public function getExpectedSubuserMonthly($date, $subuser, $sortByMetric, $sortByDirection, $limit, $offset)
|
228 |
+
{
|
229 |
+
return [
|
230 |
+
'date' => $date,
|
231 |
+
'subuser' => $subuser,
|
232 |
+
'sort_by_metric' => $sortByMetric,
|
233 |
+
'sort_by_direction' => $sortByDirection,
|
234 |
+
'limit' => $limit,
|
235 |
+
'offset' => $offset
|
236 |
+
];
|
237 |
+
}
|
238 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/phpunit.xml.dist
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<phpunit colors="true" bootstrap="../vendor/autoload.php">
|
3 |
+
<testsuites>
|
4 |
+
<testsuite name="All">
|
5 |
+
<directory>.</directory>
|
6 |
+
</testsuite>
|
7 |
+
</testsuites>
|
8 |
+
</phpunit>
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/prism.sh
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
get_latest_release() {
|
4 |
+
curl --silent "https://api.github.com/repos/stoplightio/prism/releases/latest" | # Get latest release from GitHub api
|
5 |
+
grep '"tag_name":' | # Get tag line
|
6 |
+
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
|
7 |
+
}
|
8 |
+
set -eu
|
9 |
+
|
10 |
+
install () {
|
11 |
+
|
12 |
+
echo "Installing Prism..."
|
13 |
+
|
14 |
+
UNAME=$(uname)
|
15 |
+
ARCH=$(uname -m)
|
16 |
+
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then
|
17 |
+
echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases"
|
18 |
+
exit 1
|
19 |
+
fi
|
20 |
+
|
21 |
+
if [ "$UNAME" = "Darwin" ] ; then
|
22 |
+
OSX_ARCH=$(uname -m)
|
23 |
+
if [ "${OSX_ARCH}" = "x86_64" ] ; then
|
24 |
+
PLATFORM="darwin_amd64"
|
25 |
+
fi
|
26 |
+
elif [ "$UNAME" = "Linux" ] ; then
|
27 |
+
LINUX_ARCH=$(uname -m)
|
28 |
+
if [ "${LINUX_ARCH}" = "i686" ] ; then
|
29 |
+
PLATFORM="linux_386"
|
30 |
+
elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
|
31 |
+
PLATFORM="linux_amd64"
|
32 |
+
fi
|
33 |
+
fi
|
34 |
+
|
35 |
+
mkdir -p ../prism/bin
|
36 |
+
LATEST=$(get_latest_release)
|
37 |
+
# URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM"
|
38 |
+
URL="https://github.com/stoplightio/prism/releases/download/v2.0.17/prism_$PLATFORM"
|
39 |
+
DEST=../prism/bin/prism
|
40 |
+
|
41 |
+
# if [ -z $LATEST ] ; then
|
42 |
+
# echo "Error requesting. Download binary from ${URL}"
|
43 |
+
# exit 1
|
44 |
+
# else
|
45 |
+
curl -L $URL -o $DEST
|
46 |
+
chmod +x $DEST
|
47 |
+
# fi
|
48 |
+
}
|
49 |
+
|
50 |
+
run () {
|
51 |
+
echo "Running prism..."
|
52 |
+
cd ../prism/bin
|
53 |
+
./prism mock --spec https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json
|
54 |
+
}
|
55 |
+
|
56 |
+
if [ -f ../prism/bin/prism ]; then
|
57 |
+
echo "Prism is already installed."
|
58 |
+
run
|
59 |
+
else
|
60 |
+
echo "Prism is not installed."
|
61 |
+
install
|
62 |
+
run
|
63 |
+
fi
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/AttachmentsTest.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests attachments.
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
namespace SendGrid\Tests;
|
15 |
+
|
16 |
+
use PHPUnit\Framework\TestCase;
|
17 |
+
use SendGrid\Mail\Attachment;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* This file tests attachments.
|
21 |
+
*
|
22 |
+
* @package SendGrid\Tests
|
23 |
+
*/
|
24 |
+
class AttachmentsTests extends TestCase
|
25 |
+
{
|
26 |
+
public function testWillEncodeNonBase64String() {
|
27 |
+
|
28 |
+
$attachment = new Attachment();
|
29 |
+
$testString = 'Twilio Sendgrid is awesome!';
|
30 |
+
|
31 |
+
$attachment->setContent($testString);
|
32 |
+
|
33 |
+
$this->assertEquals(base64_encode($testString), $attachment->getContent());
|
34 |
+
}
|
35 |
+
|
36 |
+
public function testWillNotEncodeBase64String() {
|
37 |
+
|
38 |
+
$attachment = new Attachment();
|
39 |
+
$testString = base64_encode('Twilio Sendgrid is awesome!');
|
40 |
+
|
41 |
+
$attachment->setContent($testString);
|
42 |
+
|
43 |
+
$this->assertEquals($testString, $attachment->getContent());
|
44 |
+
}
|
45 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/DynamicTemplateTest.php
ADDED
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the dynamic/transactional template functionality for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
// Test each use case that uses substitutions
|
18 |
+
|
19 |
+
/**
|
20 |
+
* This class tests the dynamic/transactional template functionality for a /mail/send API call
|
21 |
+
*
|
22 |
+
* @package SendGrid\Tests
|
23 |
+
*/
|
24 |
+
class DynamicTemplateTest extends BaseTestClass
|
25 |
+
{
|
26 |
+
|
27 |
+
private $REQUEST_OBJECT_LEGACY = <<<'JSON'
|
28 |
+
{
|
29 |
+
"content": [
|
30 |
+
{
|
31 |
+
"type": "text/plain",
|
32 |
+
"value": "and easy to do anywhere, even with PHP"
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"type": "text/html",
|
36 |
+
"value": "<strong>and easy to do anywhere, even with PHP</strong>"
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"type": "text/calendar",
|
40 |
+
"value": "Party Time!!"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"type": "text/calendar2",
|
44 |
+
"value": "Party Time 2!!"
|
45 |
+
}
|
46 |
+
],
|
47 |
+
"from": {
|
48 |
+
"email": "test@example.com",
|
49 |
+
"name": "DX"
|
50 |
+
},
|
51 |
+
"subject": "Sending with Twilio SendGrid is Fun and Global 2",
|
52 |
+
"personalizations": [
|
53 |
+
{
|
54 |
+
"bcc": [
|
55 |
+
{
|
56 |
+
"email": "test+7@example.com",
|
57 |
+
"name": "Example User7"
|
58 |
+
},
|
59 |
+
{
|
60 |
+
"email": "test+8@example.com",
|
61 |
+
"name": "Example User8"
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"email": "test+9@example.com",
|
65 |
+
"name": "Example User9"
|
66 |
+
}
|
67 |
+
],
|
68 |
+
"cc": [
|
69 |
+
{
|
70 |
+
"email": "test+4@example.com",
|
71 |
+
"name": "Example User4"
|
72 |
+
},
|
73 |
+
{
|
74 |
+
"email": "test+5@example.com",
|
75 |
+
"name": "Example User5"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"email": "test+6@example.com",
|
79 |
+
"name": "Example User6"
|
80 |
+
}
|
81 |
+
],
|
82 |
+
"substitutions": {
|
83 |
+
"%city1%": "Denver",
|
84 |
+
"%city2%": "Orange",
|
85 |
+
"%name1%": "Example Name 1",
|
86 |
+
"%name2%": "Example Name 2"
|
87 |
+
},
|
88 |
+
"to": [
|
89 |
+
{
|
90 |
+
"email": "test@example.com",
|
91 |
+
"name": "Example User"
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"email": "test+1@example.com",
|
95 |
+
"name": "Example User1"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"email": "test+2@example.com",
|
99 |
+
"name": "Example User2"
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"email": "test+3@example.com",
|
103 |
+
"name": "Example User3"
|
104 |
+
}
|
105 |
+
]
|
106 |
+
}
|
107 |
+
],
|
108 |
+
"template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932"
|
109 |
+
}
|
110 |
+
JSON;
|
111 |
+
|
112 |
+
private $REQUEST_OBJECT = <<<'JSON'
|
113 |
+
{
|
114 |
+
"content": [
|
115 |
+
{
|
116 |
+
"type": "text/plain",
|
117 |
+
"value": "and easy to do anywhere, even with PHP"
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"type": "text/html",
|
121 |
+
"value": "<strong>and easy to do anywhere, even with PHP</strong>"
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"type": "text/calendar",
|
125 |
+
"value": "Party Time!!"
|
126 |
+
},
|
127 |
+
{
|
128 |
+
"type": "text/calendar2",
|
129 |
+
"value": "Party Time 2!!"
|
130 |
+
}
|
131 |
+
],
|
132 |
+
"from": {
|
133 |
+
"email": "test@example.com",
|
134 |
+
"name": "DX"
|
135 |
+
},
|
136 |
+
"subject": "Sending with Twilio SendGrid is Fun and Global 2",
|
137 |
+
"personalizations": [
|
138 |
+
{
|
139 |
+
"bcc": [
|
140 |
+
{
|
141 |
+
"email": "test+7@example.com",
|
142 |
+
"name": "Example User7"
|
143 |
+
},
|
144 |
+
{
|
145 |
+
"email": "test+8@example.com",
|
146 |
+
"name": "Example User8"
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"email": "test+9@example.com",
|
150 |
+
"name": "Example User9"
|
151 |
+
}
|
152 |
+
],
|
153 |
+
"cc": [
|
154 |
+
{
|
155 |
+
"email": "test+4@example.com",
|
156 |
+
"name": "Example User4"
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"email": "test+5@example.com",
|
160 |
+
"name": "Example User5"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"email": "test+6@example.com",
|
164 |
+
"name": "Example User6"
|
165 |
+
}
|
166 |
+
],
|
167 |
+
"dynamic_template_data": {
|
168 |
+
"%city1%": "Denver",
|
169 |
+
"%city2%": "Orange",
|
170 |
+
"%name1%": "Example Name 1",
|
171 |
+
"%name2%": "Example Name 2"
|
172 |
+
},
|
173 |
+
"to": [
|
174 |
+
{
|
175 |
+
"email": "test@example.com",
|
176 |
+
"name": "Example User"
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"email": "test+1@example.com",
|
180 |
+
"name": "Example User1"
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"email": "test+2@example.com",
|
184 |
+
"name": "Example User2"
|
185 |
+
},
|
186 |
+
{
|
187 |
+
"email": "test+3@example.com",
|
188 |
+
"name": "Example User3"
|
189 |
+
}
|
190 |
+
]
|
191 |
+
}
|
192 |
+
],
|
193 |
+
"template_id": "d-13b8f94f-bcae-4ec6-b752-70d6cb59f932"
|
194 |
+
}
|
195 |
+
JSON;
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Test all parameters without using objects
|
199 |
+
*/
|
200 |
+
public function testKitchenSinkExampleWithoutObjectsAndLegacyTemplate()
|
201 |
+
{
|
202 |
+
$email = new \SendGrid\Mail\Mail();
|
203 |
+
|
204 |
+
// For a detailed description of each of these settings,
|
205 |
+
// please see the
|
206 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
207 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun 2");
|
208 |
+
|
209 |
+
$email->addTo("test@example.com", "Example User");
|
210 |
+
$email->addTo("test+1@example.com", "Example User1");
|
211 |
+
$toEmails = [
|
212 |
+
"test+2@example.com" => "Example User2",
|
213 |
+
"test+3@example.com" => "Example User3"
|
214 |
+
];
|
215 |
+
$email->addTos($toEmails);
|
216 |
+
|
217 |
+
$email->addCc("test+4@example.com", "Example User4");
|
218 |
+
$ccEmails = [
|
219 |
+
"test+5@example.com" => "Example User5",
|
220 |
+
"test+6@example.com" => "Example User6"
|
221 |
+
];
|
222 |
+
$email->addCcs($ccEmails);
|
223 |
+
|
224 |
+
$email->addBcc("test+7@example.com", "Example User7");
|
225 |
+
$bccEmails = [
|
226 |
+
"test+8@example.com" => "Example User8",
|
227 |
+
"test+9@example.com" => "Example User9"
|
228 |
+
];
|
229 |
+
$email->addBccs($bccEmails);
|
230 |
+
|
231 |
+
$email->addSubstitution("%name1%", "Example Name 1");
|
232 |
+
$email->addSubstitution("%city1%", "Denver");
|
233 |
+
$substitutions = [
|
234 |
+
"%name2%" => "Example Name 2",
|
235 |
+
"%city2%" => "Orange"
|
236 |
+
];
|
237 |
+
$email->addSubstitutions($substitutions);
|
238 |
+
|
239 |
+
// The values below this comment are global to entire message
|
240 |
+
|
241 |
+
$email->setFrom("test@example.com", "DX");
|
242 |
+
|
243 |
+
$email->setGlobalSubject("Sending with Twilio SendGrid is Fun and Global 2");
|
244 |
+
|
245 |
+
$email->addContent(
|
246 |
+
"text/plain",
|
247 |
+
"and easy to do anywhere, even with PHP"
|
248 |
+
);
|
249 |
+
$email->addContent(
|
250 |
+
"text/html",
|
251 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
252 |
+
);
|
253 |
+
$contents = [
|
254 |
+
"text/calendar" => "Party Time!!",
|
255 |
+
"text/calendar2" => "Party Time 2!!"
|
256 |
+
];
|
257 |
+
$email->addContents($contents);
|
258 |
+
|
259 |
+
$email->setTemplateId("d-13b8f94f-bcae-4ec6-b752-70d6cb59f932");
|
260 |
+
|
261 |
+
$json = json_encode($email->jsonSerialize());
|
262 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
263 |
+
$this->assertTrue($isEqual);
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Test all parameters without using objects with Dynamic Templates
|
268 |
+
*/
|
269 |
+
public function testKitchenSinkExampleWithoutObjectsAndDynamicTemplate()
|
270 |
+
{
|
271 |
+
$email = new \SendGrid\Mail\Mail();
|
272 |
+
|
273 |
+
// For a detailed description of each of these settings,
|
274 |
+
// please see the
|
275 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
276 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun 2");
|
277 |
+
|
278 |
+
$email->addTo("test@example.com", "Example User");
|
279 |
+
$email->addTo("test+1@example.com", "Example User1");
|
280 |
+
$toEmails = [
|
281 |
+
"test+2@example.com" => "Example User2",
|
282 |
+
"test+3@example.com" => "Example User3"
|
283 |
+
];
|
284 |
+
$email->addTos($toEmails);
|
285 |
+
|
286 |
+
$email->addCc("test+4@example.com", "Example User4");
|
287 |
+
$ccEmails = [
|
288 |
+
"test+5@example.com" => "Example User5",
|
289 |
+
"test+6@example.com" => "Example User6"
|
290 |
+
];
|
291 |
+
$email->addCcs($ccEmails);
|
292 |
+
|
293 |
+
$email->addBcc("test+7@example.com", "Example User7");
|
294 |
+
$bccEmails = [
|
295 |
+
"test+8@example.com" => "Example User8",
|
296 |
+
"test+9@example.com" => "Example User9"
|
297 |
+
];
|
298 |
+
$email->addBccs($bccEmails);
|
299 |
+
|
300 |
+
$email->addSubstitution("%name1%", "Example Name 1");
|
301 |
+
$email->addSubstitution("%city1%", "Denver");
|
302 |
+
$substitutions = [
|
303 |
+
"%name2%" => "Example Name 2",
|
304 |
+
"%city2%" => "Orange"
|
305 |
+
];
|
306 |
+
$email->addSubstitutions($substitutions);
|
307 |
+
|
308 |
+
// The values below this comment are global to entire message
|
309 |
+
|
310 |
+
$email->setFrom("test@example.com", "DX");
|
311 |
+
|
312 |
+
$email->setGlobalSubject("Sending with Twilio SendGrid is Fun and Global 2");
|
313 |
+
|
314 |
+
$email->addContent(
|
315 |
+
"text/plain",
|
316 |
+
"and easy to do anywhere, even with PHP"
|
317 |
+
);
|
318 |
+
$email->addContent(
|
319 |
+
"text/html",
|
320 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
321 |
+
);
|
322 |
+
$contents = [
|
323 |
+
"text/calendar" => "Party Time!!",
|
324 |
+
"text/calendar2" => "Party Time 2!!"
|
325 |
+
];
|
326 |
+
$email->addContents($contents);
|
327 |
+
|
328 |
+
$email->setTemplateId("d-13b8f94f-bcae-4ec6-b752-70d6cb59f932");
|
329 |
+
|
330 |
+
$json = json_encode($email->jsonSerialize());
|
331 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
332 |
+
$this->assertTrue($isEqual);
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Test all parameters using objects
|
337 |
+
*/
|
338 |
+
public function testKitchenSinkExampleWithObjectsAndLegacyTemplate()
|
339 |
+
{
|
340 |
+
$email = new \SendGrid\Mail\Mail();
|
341 |
+
|
342 |
+
// For a detailed description of each of these settings,
|
343 |
+
// please see the
|
344 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
345 |
+
$email->setSubject(
|
346 |
+
new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun 2")
|
347 |
+
);
|
348 |
+
|
349 |
+
$email->addTo(new \SendGrid\Mail\To("test@example.com", "Example User"));
|
350 |
+
$email->addTo(new \SendGrid\Mail\To("test+1@example.com", "Example User1"));
|
351 |
+
$toEmails = [
|
352 |
+
new \SendGrid\Mail\To("test+2@example.com", "Example User2"),
|
353 |
+
new \SendGrid\Mail\To("test+3@example.com", "Example User3")
|
354 |
+
];
|
355 |
+
$email->addTos($toEmails);
|
356 |
+
|
357 |
+
$email->addCc(new \SendGrid\Mail\Cc("test+4@example.com", "Example User4"));
|
358 |
+
$ccEmails = [
|
359 |
+
new \SendGrid\Mail\Cc("test+5@example.com", "Example User5"),
|
360 |
+
new \SendGrid\Mail\Cc("test+6@example.com", "Example User6")
|
361 |
+
];
|
362 |
+
$email->addCcs($ccEmails);
|
363 |
+
|
364 |
+
$email->addBcc(
|
365 |
+
new \SendGrid\Mail\Bcc("test+7@example.com", "Example User7")
|
366 |
+
);
|
367 |
+
$bccEmails = [
|
368 |
+
new \SendGrid\Mail\Bcc("test+8@example.com", "Example User8"),
|
369 |
+
new \SendGrid\Mail\Bcc("test+9@example.com", "Example User9")
|
370 |
+
];
|
371 |
+
$email->addBccs($bccEmails);
|
372 |
+
|
373 |
+
$email->addSubstitution(
|
374 |
+
new \SendGrid\Mail\Substitution("%name1%", "Example Name 1")
|
375 |
+
);
|
376 |
+
$email->addSubstitution(
|
377 |
+
new \SendGrid\Mail\Substitution("%city1%", "Denver")
|
378 |
+
);
|
379 |
+
$substitutions = [
|
380 |
+
new \SendGrid\Mail\Substitution("%name2%", "Example Name 2"),
|
381 |
+
new \SendGrid\Mail\Substitution("%city2%", "Orange")
|
382 |
+
];
|
383 |
+
$email->addSubstitutions($substitutions);
|
384 |
+
|
385 |
+
// The values below this comment are global to entire message
|
386 |
+
|
387 |
+
$email->setFrom(new \SendGrid\Mail\From("test@example.com", "DX"));
|
388 |
+
|
389 |
+
$email->setGlobalSubject(
|
390 |
+
new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun and Global 2")
|
391 |
+
);
|
392 |
+
|
393 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
394 |
+
"and easy to do anywhere, even with PHP"
|
395 |
+
);
|
396 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
397 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
398 |
+
);
|
399 |
+
$email->addContent($plainTextContent);
|
400 |
+
$email->addContent($htmlContent);
|
401 |
+
$contents = [
|
402 |
+
new \SendGrid\Mail\Content("text/calendar", "Party Time!!"),
|
403 |
+
new \SendGrid\Mail\Content("text/calendar2", "Party Time 2!!")
|
404 |
+
];
|
405 |
+
$email->addContents($contents);
|
406 |
+
|
407 |
+
$email->setTemplateId(
|
408 |
+
new \SendGrid\Mail\TemplateId("13b8f94f-bcae-4ec6-b752-70d6cb59f932")
|
409 |
+
);
|
410 |
+
|
411 |
+
$json = json_encode($email->jsonSerialize());
|
412 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT_LEGACY);
|
413 |
+
$this->assertTrue($isEqual);
|
414 |
+
}
|
415 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/FilesExistTest.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the existence of necessary files in this repo
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
use PHPUnit\Framework\TestCase;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* This class tests the existence of necessary files in this repo
|
21 |
+
*
|
22 |
+
* @package SendGrid\Tests
|
23 |
+
*/
|
24 |
+
class FilesExistTest extends TestCase
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* This method tests that the required files exist in the repo
|
28 |
+
*/
|
29 |
+
public function testFilesArePresentInRepo()
|
30 |
+
{
|
31 |
+
$rootDir = __DIR__ . '/../..';
|
32 |
+
$this->assertFileExists("$rootDir/docker/Dockerfile");
|
33 |
+
//$this->assertFileExists("$rootDir/docker/docker-compose.yml");
|
34 |
+
$this->assertFileExists("$rootDir/.codeclimate.yml");
|
35 |
+
$this->assertFileExists("$rootDir/.env.sample");
|
36 |
+
$this->assertFileExists("$rootDir/.github/ISSUE_TEMPLATE");
|
37 |
+
$this->assertFileExists("$rootDir/.github/PULL_REQUEST_TEMPLATE");
|
38 |
+
$this->assertFileExists("$rootDir/.gitignore");
|
39 |
+
$this->assertFileExists("$rootDir/.travis.yml");
|
40 |
+
$this->assertFileExists("$rootDir/CHANGELOG.md");
|
41 |
+
$this->assertFileExists("$rootDir/CODE_OF_CONDUCT.md");
|
42 |
+
$this->assertFileExists("$rootDir/LICENSE.md");
|
43 |
+
$this->assertFileExists("$rootDir/README.md");
|
44 |
+
$this->assertFileExists("$rootDir/TROUBLESHOOTING.md");
|
45 |
+
$this->assertFileExists("$rootDir/USAGE.md");
|
46 |
+
$this->assertFileExists("$rootDir/USE_CASES.md");
|
47 |
+
}
|
48 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/KitchenSinkTest.php
ADDED
@@ -0,0 +1,1229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the request object generation for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class tests the request object generation for a /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Tests
|
21 |
+
*/
|
22 |
+
class KitchenSinkTest extends BaseTestClass
|
23 |
+
{
|
24 |
+
|
25 |
+
private $REQUEST_OBJECT_DYNAMIC = <<<'JSON'
|
26 |
+
{
|
27 |
+
"asm": {
|
28 |
+
"group_id": 1,
|
29 |
+
"groups_to_display": [
|
30 |
+
1,
|
31 |
+
2,
|
32 |
+
3,
|
33 |
+
4
|
34 |
+
]
|
35 |
+
},
|
36 |
+
"attachments": [
|
37 |
+
{
|
38 |
+
"content": "YmFzZTY0IGVuY29kZWQgY29udGVudDE=",
|
39 |
+
"content_id": "Banner",
|
40 |
+
"disposition": "inline",
|
41 |
+
"filename": "banner.png",
|
42 |
+
"type": "image/png"
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"content": "YmFzZTY0IGVuY29kZWQgY29udGVudDI=",
|
46 |
+
"content_id": "Banner 3",
|
47 |
+
"disposition": "attachment",
|
48 |
+
"filename": "image/jpeg",
|
49 |
+
"type": "banner2.jpeg"
|
50 |
+
},
|
51 |
+
{
|
52 |
+
"content": "YmFzZTY0IGVuY29kZWQgY29udGVudDM=",
|
53 |
+
"content_id": "Banner 3",
|
54 |
+
"disposition": "inline",
|
55 |
+
"filename": "image/gif",
|
56 |
+
"type": "banner3.gif"
|
57 |
+
}
|
58 |
+
],
|
59 |
+
"batch_id": "MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw",
|
60 |
+
"categories": [
|
61 |
+
"Category 1",
|
62 |
+
"Category 2",
|
63 |
+
"Category 3"
|
64 |
+
],
|
65 |
+
"content": [
|
66 |
+
{
|
67 |
+
"type": "text/plain",
|
68 |
+
"value": "and easy to do anywhere, even with PHP"
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"type": "text/html",
|
72 |
+
"value": "<strong>and easy to do anywhere, even with PHP</strong>"
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"type": "text/calendar",
|
76 |
+
"value": "Party Time!!"
|
77 |
+
},
|
78 |
+
{
|
79 |
+
"type": "text/calendar2",
|
80 |
+
"value": "Party Time 2!!"
|
81 |
+
}
|
82 |
+
],
|
83 |
+
"from": {
|
84 |
+
"email": "test@example.com",
|
85 |
+
"name": "DX"
|
86 |
+
},
|
87 |
+
"headers": {
|
88 |
+
"X-Day": "Monday",
|
89 |
+
"X-Month": "January",
|
90 |
+
"X-Year": "2017"
|
91 |
+
},
|
92 |
+
"ip_pool_name": "23",
|
93 |
+
"mail_settings": {
|
94 |
+
"bcc": {
|
95 |
+
"email": "bcc@example.com",
|
96 |
+
"enable": true
|
97 |
+
},
|
98 |
+
"bypass_list_management": {
|
99 |
+
"enable": true
|
100 |
+
},
|
101 |
+
"footer": {
|
102 |
+
"enable": true,
|
103 |
+
"html": "<strong>Footer</strong>",
|
104 |
+
"text": "Footer"
|
105 |
+
},
|
106 |
+
"sandbox_mode": {
|
107 |
+
"enable": true
|
108 |
+
},
|
109 |
+
"spam_check": {
|
110 |
+
"enable": true,
|
111 |
+
"post_to_url": "http://mydomain.com",
|
112 |
+
"threshold": 1
|
113 |
+
}
|
114 |
+
},
|
115 |
+
"personalizations": [
|
116 |
+
{
|
117 |
+
"bcc": [
|
118 |
+
{
|
119 |
+
"email": "test+7@example.com",
|
120 |
+
"name": "Example User7"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"email": "test+8@example.com",
|
124 |
+
"name": "Example User8"
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"email": "test+9@example.com",
|
128 |
+
"name": "Example User9"
|
129 |
+
}
|
130 |
+
],
|
131 |
+
"cc": [
|
132 |
+
{
|
133 |
+
"email": "test+4@example.com",
|
134 |
+
"name": "Example User4"
|
135 |
+
},
|
136 |
+
{
|
137 |
+
"email": "test+5@example.com",
|
138 |
+
"name": "Example User5"
|
139 |
+
},
|
140 |
+
{
|
141 |
+
"email": "test+6@example.com",
|
142 |
+
"name": "Example User6"
|
143 |
+
}
|
144 |
+
],
|
145 |
+
"custom_args": {
|
146 |
+
"category": "name",
|
147 |
+
"marketing1": "false",
|
148 |
+
"marketing2": "true",
|
149 |
+
"transactional1": "true",
|
150 |
+
"transactional2": "false"
|
151 |
+
},
|
152 |
+
"headers": {
|
153 |
+
"X-Test1": "Test1",
|
154 |
+
"X-Test2": "Test2",
|
155 |
+
"X-Test3": "Test3",
|
156 |
+
"X-Test4": "Test4"
|
157 |
+
},
|
158 |
+
"send_at": 1461775051,
|
159 |
+
"dynamic_template_data": {
|
160 |
+
"object": {
|
161 |
+
"key1": "Key 1",
|
162 |
+
"key2": "Key 2"
|
163 |
+
},
|
164 |
+
"boolean": false,
|
165 |
+
"array": [
|
166 |
+
"index0",
|
167 |
+
"index1"
|
168 |
+
],
|
169 |
+
"number": 1
|
170 |
+
},
|
171 |
+
"to": [
|
172 |
+
{
|
173 |
+
"email": "test@example.com",
|
174 |
+
"name": "Example User"
|
175 |
+
},
|
176 |
+
{
|
177 |
+
"email": "test+1@example.com",
|
178 |
+
"name": "Example User1"
|
179 |
+
},
|
180 |
+
{
|
181 |
+
"email": "test+2@example.com",
|
182 |
+
"name": "Example User2"
|
183 |
+
},
|
184 |
+
{
|
185 |
+
"email": "test+3@example.com",
|
186 |
+
"name": "Example User3"
|
187 |
+
}
|
188 |
+
]
|
189 |
+
}
|
190 |
+
],
|
191 |
+
"reply_to": {
|
192 |
+
"email": "dx+replyto2@example.com",
|
193 |
+
"name": "DX Team Reply To 2"
|
194 |
+
},
|
195 |
+
"sections": {
|
196 |
+
"%section1%": "Substitution for Section 1 Tag",
|
197 |
+
"%section3%": "Substitution for Section 3 Tag",
|
198 |
+
"%section4%": "Substitution for Section 4 Tag"
|
199 |
+
},
|
200 |
+
"subject": "Sending with Twilio SendGrid is Fun and Global 2",
|
201 |
+
"template_id": "d-13b8f94fbcae4ec6b75270d6cb59f932",
|
202 |
+
"tracking_settings": {
|
203 |
+
"click_tracking": {
|
204 |
+
"enable": true,
|
205 |
+
"enable_text": true
|
206 |
+
},
|
207 |
+
"ganalytics": {
|
208 |
+
"enable": true,
|
209 |
+
"utm_campaign": "utm_campaign",
|
210 |
+
"utm_content": "utm_content",
|
211 |
+
"utm_medium": "utm_medium",
|
212 |
+
"utm_source": "utm_source",
|
213 |
+
"utm_term": "utm_term"
|
214 |
+
},
|
215 |
+
"open_tracking": {
|
216 |
+
"enable": true,
|
217 |
+
"substitution_tag": "--sub--"
|
218 |
+
},
|
219 |
+
"subscription_tracking": {
|
220 |
+
"enable": true,
|
221 |
+
"html": "<bold>subscribe</bold>",
|
222 |
+
"substitution_tag": "%%sub%%",
|
223 |
+
"text": "subscribe"
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
JSON;
|
228 |
+
|
229 |
+
private $REQUEST_OBJECT = <<<'JSON'
|
230 |
+
{
|
231 |
+
"asm": {
|
232 |
+
"group_id": 1,
|
233 |
+
"groups_to_display": [
|
234 |
+
1,
|
235 |
+
2,
|
236 |
+
3,
|
237 |
+
4
|
238 |
+
]
|
239 |
+
},
|
240 |
+
"attachments": [
|
241 |
+
{
|
242 |
+
"content": "YmFzZTY0IGVuY29kZWQgY29udGVudDE=",
|
243 |
+
"content_id": "Banner",
|
244 |
+
"disposition": "inline",
|
245 |
+
"filename": "banner.png",
|
246 |
+
"type": "image/png"
|
247 |
+
},
|
248 |
+
{
|
249 |
+
"content": "YmFzZTY0IGVuY29kZWQgY29udGVudDI=",
|
250 |
+
"content_id": "Banner 3",
|
251 |
+
"disposition": "attachment",
|
252 |
+
"filename": "image/jpeg",
|
253 |
+
"type": "banner2.jpeg"
|
254 |
+
},
|
255 |
+
{
|
256 |
+
"content": "YmFzZTY0IGVuY29kZWQgY29udGVudDM=",
|
257 |
+
"content_id": "Banner 3",
|
258 |
+
"disposition": "inline",
|
259 |
+
"filename": "image/gif",
|
260 |
+
"type": "banner3.gif"
|
261 |
+
}
|
262 |
+
],
|
263 |
+
"batch_id": "MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw",
|
264 |
+
"categories": [
|
265 |
+
"Category 1",
|
266 |
+
"Category 2",
|
267 |
+
"Category 3"
|
268 |
+
],
|
269 |
+
"content": [
|
270 |
+
{
|
271 |
+
"type": "text/plain",
|
272 |
+
"value": "and easy to do anywhere, even with PHP"
|
273 |
+
},
|
274 |
+
{
|
275 |
+
"type": "text/html",
|
276 |
+
"value": "<strong>and easy to do anywhere, even with PHP</strong>"
|
277 |
+
},
|
278 |
+
{
|
279 |
+
"type": "text/calendar",
|
280 |
+
"value": "Party Time!!"
|
281 |
+
},
|
282 |
+
{
|
283 |
+
"type": "text/calendar2",
|
284 |
+
"value": "Party Time 2!!"
|
285 |
+
}
|
286 |
+
],
|
287 |
+
"from": {
|
288 |
+
"email": "test@example.com",
|
289 |
+
"name": "DX"
|
290 |
+
},
|
291 |
+
"headers": {
|
292 |
+
"X-Day": "Monday",
|
293 |
+
"X-Month": "January",
|
294 |
+
"X-Year": "2017"
|
295 |
+
},
|
296 |
+
"ip_pool_name": "23",
|
297 |
+
"mail_settings": {
|
298 |
+
"bcc": {
|
299 |
+
"email": "bcc@example.com",
|
300 |
+
"enable": true
|
301 |
+
},
|
302 |
+
"bypass_list_management": {
|
303 |
+
"enable": true
|
304 |
+
},
|
305 |
+
"footer": {
|
306 |
+
"enable": true,
|
307 |
+
"html": "<strong>Footer</strong>",
|
308 |
+
"text": "Footer"
|
309 |
+
},
|
310 |
+
"sandbox_mode": {
|
311 |
+
"enable": true
|
312 |
+
},
|
313 |
+
"spam_check": {
|
314 |
+
"enable": true,
|
315 |
+
"post_to_url": "http://mydomain.com",
|
316 |
+
"threshold": 1
|
317 |
+
}
|
318 |
+
},
|
319 |
+
"personalizations": [
|
320 |
+
{
|
321 |
+
"bcc": [
|
322 |
+
{
|
323 |
+
"email": "test+7@example.com",
|
324 |
+
"name": "Example User7"
|
325 |
+
},
|
326 |
+
{
|
327 |
+
"email": "test+8@example.com",
|
328 |
+
"name": "Example User8"
|
329 |
+
},
|
330 |
+
{
|
331 |
+
"email": "test+9@example.com",
|
332 |
+
"name": "Example User9"
|
333 |
+
}
|
334 |
+
],
|
335 |
+
"cc": [
|
336 |
+
{
|
337 |
+
"email": "test+4@example.com",
|
338 |
+
"name": "Example User4"
|
339 |
+
},
|
340 |
+
{
|
341 |
+
"email": "test+5@example.com",
|
342 |
+
"name": "Example User5"
|
343 |
+
},
|
344 |
+
{
|
345 |
+
"email": "test+6@example.com",
|
346 |
+
"name": "Example User6"
|
347 |
+
}
|
348 |
+
],
|
349 |
+
"custom_args": {
|
350 |
+
"category": "name",
|
351 |
+
"marketing1": "false",
|
352 |
+
"marketing2": "true",
|
353 |
+
"transactional1": "true",
|
354 |
+
"transactional2": "false"
|
355 |
+
},
|
356 |
+
"headers": {
|
357 |
+
"X-Test1": "Test1",
|
358 |
+
"X-Test2": "Test2",
|
359 |
+
"X-Test3": "Test3",
|
360 |
+
"X-Test4": "Test4"
|
361 |
+
},
|
362 |
+
"send_at": 1461775051,
|
363 |
+
"substitutions": {
|
364 |
+
"%city1%": "Denver",
|
365 |
+
"%city2%": "Orange",
|
366 |
+
"%name1%": "Example Name 1",
|
367 |
+
"%name2%": "Example Name 2"
|
368 |
+
},
|
369 |
+
"to": [
|
370 |
+
{
|
371 |
+
"email": "test@example.com",
|
372 |
+
"name": "Example User"
|
373 |
+
},
|
374 |
+
{
|
375 |
+
"email": "test+1@example.com",
|
376 |
+
"name": "Example User1"
|
377 |
+
},
|
378 |
+
{
|
379 |
+
"email": "test+2@example.com",
|
380 |
+
"name": "Example User2"
|
381 |
+
},
|
382 |
+
{
|
383 |
+
"email": "test+3@example.com",
|
384 |
+
"name": "Example User3"
|
385 |
+
}
|
386 |
+
]
|
387 |
+
}
|
388 |
+
],
|
389 |
+
"reply_to": {
|
390 |
+
"email": "dx+replyto2@example.com",
|
391 |
+
"name": "DX Team Reply To 2"
|
392 |
+
},
|
393 |
+
"sections": {
|
394 |
+
"%section1%": "Substitution for Section 1 Tag",
|
395 |
+
"%section3%": "Substitution for Section 3 Tag",
|
396 |
+
"%section4%": "Substitution for Section 4 Tag"
|
397 |
+
},
|
398 |
+
"subject": "Sending with Twilio SendGrid is Fun and Global 2",
|
399 |
+
"template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932",
|
400 |
+
"tracking_settings": {
|
401 |
+
"click_tracking": {
|
402 |
+
"enable": true,
|
403 |
+
"enable_text": true
|
404 |
+
},
|
405 |
+
"ganalytics": {
|
406 |
+
"enable": true,
|
407 |
+
"utm_campaign": "utm_campaign",
|
408 |
+
"utm_content": "utm_content",
|
409 |
+
"utm_medium": "utm_medium",
|
410 |
+
"utm_source": "utm_source",
|
411 |
+
"utm_term": "utm_term"
|
412 |
+
},
|
413 |
+
"open_tracking": {
|
414 |
+
"enable": true,
|
415 |
+
"substitution_tag": "--sub--"
|
416 |
+
},
|
417 |
+
"subscription_tracking": {
|
418 |
+
"enable": true,
|
419 |
+
"html": "<bold>subscribe</bold>",
|
420 |
+
"substitution_tag": "%%sub%%",
|
421 |
+
"text": "subscribe"
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
JSON;
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Test all parameters without using objects
|
429 |
+
*/
|
430 |
+
public function testKitchenSinkExampleWithoutObjects()
|
431 |
+
{
|
432 |
+
$email = new \SendGrid\Mail\Mail();
|
433 |
+
|
434 |
+
// For a detailed description of each of these settings,
|
435 |
+
// please see the
|
436 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
437 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun 2");
|
438 |
+
|
439 |
+
$email->addTo("test@example.com", "Example User");
|
440 |
+
$email->addTo("test+1@example.com", "Example User1");
|
441 |
+
$toEmails = [
|
442 |
+
"test+2@example.com" => "Example User2",
|
443 |
+
"test+3@example.com" => "Example User3"
|
444 |
+
];
|
445 |
+
$email->addTos($toEmails);
|
446 |
+
|
447 |
+
$email->addCc("test+4@example.com", "Example User4");
|
448 |
+
$ccEmails = [
|
449 |
+
"test+5@example.com" => "Example User5",
|
450 |
+
"test+6@example.com" => "Example User6"
|
451 |
+
];
|
452 |
+
$email->addCcs($ccEmails);
|
453 |
+
|
454 |
+
$email->addBcc("test+7@example.com", "Example User7");
|
455 |
+
$bccEmails = [
|
456 |
+
"test+8@example.com" => "Example User8",
|
457 |
+
"test+9@example.com" => "Example User9"
|
458 |
+
];
|
459 |
+
$email->addBccs($bccEmails);
|
460 |
+
|
461 |
+
$email->addHeader("X-Test1", "Test1");
|
462 |
+
$email->addHeader("X-Test2", "Test2");
|
463 |
+
$headers = [
|
464 |
+
"X-Test3" => "Test3",
|
465 |
+
"X-Test4" => "Test4",
|
466 |
+
];
|
467 |
+
$email->addHeaders($headers);
|
468 |
+
|
469 |
+
$email->addSubstitution("%name1%", "Example Name 1");
|
470 |
+
$email->addSubstitution("%city1%", "Denver");
|
471 |
+
$substitutions = [
|
472 |
+
"%name2%" => "Example Name 2",
|
473 |
+
"%city2%" => "Orange"
|
474 |
+
];
|
475 |
+
$email->addSubstitutions($substitutions);
|
476 |
+
|
477 |
+
$email->addCustomArg("marketing1", "false");
|
478 |
+
$email->addCustomArg("transactional1", "true");
|
479 |
+
$email->addCustomArg("category", "name");
|
480 |
+
$customArgs = [
|
481 |
+
"marketing2" => "true",
|
482 |
+
"transactional2" => "false",
|
483 |
+
"category" => "name"
|
484 |
+
];
|
485 |
+
$email->addCustomArgs($customArgs);
|
486 |
+
|
487 |
+
$email->setSendAt(1461775051);
|
488 |
+
|
489 |
+
// The values below this comment are global to entire message
|
490 |
+
|
491 |
+
$email->setFrom("test@example.com", "DX");
|
492 |
+
|
493 |
+
$email->setGlobalSubject("Sending with Twilio SendGrid is Fun and Global 2");
|
494 |
+
|
495 |
+
$email->addContent(
|
496 |
+
"text/plain",
|
497 |
+
"and easy to do anywhere, even with PHP"
|
498 |
+
);
|
499 |
+
$email->addContent(
|
500 |
+
"text/html",
|
501 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
502 |
+
);
|
503 |
+
$contents = [
|
504 |
+
"text/calendar" => "Party Time!!",
|
505 |
+
"text/calendar2" => "Party Time 2!!"
|
506 |
+
];
|
507 |
+
$email->addContents($contents);
|
508 |
+
|
509 |
+
$email->addAttachment(
|
510 |
+
"base64 encoded content1",
|
511 |
+
"image/png",
|
512 |
+
"banner.png",
|
513 |
+
"inline",
|
514 |
+
"Banner"
|
515 |
+
);
|
516 |
+
$attachments = [
|
517 |
+
[
|
518 |
+
"base64 encoded content2",
|
519 |
+
"banner2.jpeg",
|
520 |
+
"image/jpeg",
|
521 |
+
"attachment",
|
522 |
+
"Banner 3"
|
523 |
+
],
|
524 |
+
[
|
525 |
+
"base64 encoded content3",
|
526 |
+
"banner3.gif",
|
527 |
+
"image/gif",
|
528 |
+
"inline",
|
529 |
+
"Banner 3"
|
530 |
+
]
|
531 |
+
];
|
532 |
+
$email->addAttachments($attachments);
|
533 |
+
|
534 |
+
$email->setTemplateId("13b8f94f-bcae-4ec6-b752-70d6cb59f932");
|
535 |
+
|
536 |
+
$email->addGlobalHeader("X-Day", "Monday");
|
537 |
+
$globalHeaders = [
|
538 |
+
"X-Month" => "January",
|
539 |
+
"X-Year" => "2017"
|
540 |
+
];
|
541 |
+
$email->addGlobalHeaders($globalHeaders);
|
542 |
+
|
543 |
+
$email->addSection("%section1%", "Substitution for Section 1 Tag");
|
544 |
+
$sections = [
|
545 |
+
"%section3%" => "Substitution for Section 3 Tag",
|
546 |
+
"%section4%" => "Substitution for Section 4 Tag"
|
547 |
+
];
|
548 |
+
$email->addSections($sections);
|
549 |
+
|
550 |
+
$email->addCategory("Category 1");
|
551 |
+
$categories = [
|
552 |
+
"Category 2",
|
553 |
+
"Category 3"
|
554 |
+
];
|
555 |
+
$email->addCategories($categories);
|
556 |
+
|
557 |
+
$email->setBatchId(
|
558 |
+
"MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw"
|
559 |
+
);
|
560 |
+
|
561 |
+
$email->setReplyTo("dx+replyto2@example.com", "DX Team Reply To 2");
|
562 |
+
|
563 |
+
$email->setAsm(1, [1, 2, 3, 4]);
|
564 |
+
|
565 |
+
$email->setIpPoolName("23");
|
566 |
+
|
567 |
+
// Mail Settings
|
568 |
+
$email->setBccSettings(true, "bcc@example.com");
|
569 |
+
$email->enableBypassListManagement();
|
570 |
+
//$email->disableBypassListManagement();
|
571 |
+
$email->setFooter(true, "Footer", "<strong>Footer</strong>");
|
572 |
+
$email->enableSandBoxMode();
|
573 |
+
//$email->disableSandBoxMode();
|
574 |
+
$email->setSpamCheck(true, 1, "http://mydomain.com");
|
575 |
+
|
576 |
+
// Tracking Settings
|
577 |
+
$email->setClickTracking(true, true);
|
578 |
+
$email->setOpenTracking(true, "--sub--");
|
579 |
+
$email->setSubscriptionTracking(
|
580 |
+
true,
|
581 |
+
"subscribe",
|
582 |
+
"<bold>subscribe</bold>",
|
583 |
+
"%%sub%%"
|
584 |
+
);
|
585 |
+
$email->setGanalytics(
|
586 |
+
true,
|
587 |
+
"utm_source",
|
588 |
+
"utm_medium",
|
589 |
+
"utm_term",
|
590 |
+
"utm_content",
|
591 |
+
"utm_campaign"
|
592 |
+
);
|
593 |
+
|
594 |
+
$json = json_encode($email->jsonSerialize());
|
595 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
596 |
+
$this->assertTrue($isEqual);
|
597 |
+
}
|
598 |
+
|
599 |
+
/**
|
600 |
+
* Test all parameters without using objects with dynamic templates
|
601 |
+
*/
|
602 |
+
public function testKitchenSinkExampleWithoutObjectsWithDynamicTemplates()
|
603 |
+
{
|
604 |
+
$email = new \SendGrid\Mail\Mail();
|
605 |
+
|
606 |
+
// For a detailed description of each of these settings,
|
607 |
+
// please see the
|
608 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
609 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun 2");
|
610 |
+
|
611 |
+
$email->addTo("test@example.com", "Example User");
|
612 |
+
$email->addTo("test+1@example.com", "Example User1");
|
613 |
+
$toEmails = [
|
614 |
+
"test+2@example.com" => "Example User2",
|
615 |
+
"test+3@example.com" => "Example User3"
|
616 |
+
];
|
617 |
+
$email->addTos($toEmails);
|
618 |
+
|
619 |
+
$email->addCc("test+4@example.com", "Example User4");
|
620 |
+
$ccEmails = [
|
621 |
+
"test+5@example.com" => "Example User5",
|
622 |
+
"test+6@example.com" => "Example User6"
|
623 |
+
];
|
624 |
+
$email->addCcs($ccEmails);
|
625 |
+
|
626 |
+
$email->addBcc("test+7@example.com", "Example User7");
|
627 |
+
$bccEmails = [
|
628 |
+
"test+8@example.com" => "Example User8",
|
629 |
+
"test+9@example.com" => "Example User9"
|
630 |
+
];
|
631 |
+
$email->addBccs($bccEmails);
|
632 |
+
|
633 |
+
$email->addHeader("X-Test1", "Test1");
|
634 |
+
$email->addHeader("X-Test2", "Test2");
|
635 |
+
$headers = [
|
636 |
+
"X-Test3" => "Test3",
|
637 |
+
"X-Test4" => "Test4",
|
638 |
+
];
|
639 |
+
$email->addHeaders($headers);
|
640 |
+
|
641 |
+
$email->addDynamicTemplateData('object', [
|
642 |
+
'key1' => 'Key 1',
|
643 |
+
'key2' => 'Key 2',
|
644 |
+
]);
|
645 |
+
$email->addDynamicTemplateData('boolean', false);
|
646 |
+
$email->addDynamicTemplateData('array', [
|
647 |
+
'index0',
|
648 |
+
'index1',
|
649 |
+
]);
|
650 |
+
$email->addDynamicTemplateData('number', 1);
|
651 |
+
|
652 |
+
$email->addCustomArg("marketing1", "false");
|
653 |
+
$email->addCustomArg("transactional1", "true");
|
654 |
+
$email->addCustomArg("category", "name");
|
655 |
+
$customArgs = [
|
656 |
+
"marketing2" => "true",
|
657 |
+
"transactional2" => "false",
|
658 |
+
"category" => "name"
|
659 |
+
];
|
660 |
+
$email->addCustomArgs($customArgs);
|
661 |
+
|
662 |
+
$email->setSendAt(1461775051);
|
663 |
+
|
664 |
+
// The values below this comment are global to entire message
|
665 |
+
|
666 |
+
$email->setFrom("test@example.com", "DX");
|
667 |
+
|
668 |
+
$email->setGlobalSubject("Sending with Twilio SendGrid is Fun and Global 2");
|
669 |
+
|
670 |
+
$email->addContent(
|
671 |
+
"text/plain",
|
672 |
+
"and easy to do anywhere, even with PHP"
|
673 |
+
);
|
674 |
+
$email->addContent(
|
675 |
+
"text/html",
|
676 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
677 |
+
);
|
678 |
+
$contents = [
|
679 |
+
"text/calendar" => "Party Time!!",
|
680 |
+
"text/calendar2" => "Party Time 2!!"
|
681 |
+
];
|
682 |
+
$email->addContents($contents);
|
683 |
+
|
684 |
+
$email->addAttachment(
|
685 |
+
"base64 encoded content1",
|
686 |
+
"image/png",
|
687 |
+
"banner.png",
|
688 |
+
"inline",
|
689 |
+
"Banner"
|
690 |
+
);
|
691 |
+
$attachments = [
|
692 |
+
[
|
693 |
+
"base64 encoded content2",
|
694 |
+
"banner2.jpeg",
|
695 |
+
"image/jpeg",
|
696 |
+
"attachment",
|
697 |
+
"Banner 3"
|
698 |
+
],
|
699 |
+
[
|
700 |
+
"base64 encoded content3",
|
701 |
+
"banner3.gif",
|
702 |
+
"image/gif",
|
703 |
+
"inline",
|
704 |
+
"Banner 3"
|
705 |
+
]
|
706 |
+
];
|
707 |
+
$email->addAttachments($attachments);
|
708 |
+
|
709 |
+
$email->setTemplateId("d-13b8f94fbcae4ec6b75270d6cb59f932");
|
710 |
+
|
711 |
+
$email->addGlobalHeader("X-Day", "Monday");
|
712 |
+
$globalHeaders = [
|
713 |
+
"X-Month" => "January",
|
714 |
+
"X-Year" => "2017"
|
715 |
+
];
|
716 |
+
$email->addGlobalHeaders($globalHeaders);
|
717 |
+
|
718 |
+
$email->addSection("%section1%", "Substitution for Section 1 Tag");
|
719 |
+
$sections = [
|
720 |
+
"%section3%" => "Substitution for Section 3 Tag",
|
721 |
+
"%section4%" => "Substitution for Section 4 Tag"
|
722 |
+
];
|
723 |
+
$email->addSections($sections);
|
724 |
+
|
725 |
+
$email->addCategory("Category 1");
|
726 |
+
$categories = [
|
727 |
+
"Category 2",
|
728 |
+
"Category 3"
|
729 |
+
];
|
730 |
+
$email->addCategories($categories);
|
731 |
+
|
732 |
+
$email->setBatchId(
|
733 |
+
"MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw"
|
734 |
+
);
|
735 |
+
|
736 |
+
$email->setReplyTo("dx+replyto2@example.com", "DX Team Reply To 2");
|
737 |
+
|
738 |
+
$email->setAsm(1, [1, 2, 3, 4]);
|
739 |
+
|
740 |
+
$email->setIpPoolName("23");
|
741 |
+
|
742 |
+
// Mail Settings
|
743 |
+
$email->setBccSettings(true, "bcc@example.com");
|
744 |
+
$email->enableBypassListManagement();
|
745 |
+
//$email->disableBypassListManagement();
|
746 |
+
$email->setFooter(true, "Footer", "<strong>Footer</strong>");
|
747 |
+
$email->enableSandBoxMode();
|
748 |
+
//$email->disableSandBoxMode();
|
749 |
+
$email->setSpamCheck(true, 1, "http://mydomain.com");
|
750 |
+
|
751 |
+
// Tracking Settings
|
752 |
+
$email->setClickTracking(true, true);
|
753 |
+
$email->setOpenTracking(true, "--sub--");
|
754 |
+
$email->setSubscriptionTracking(
|
755 |
+
true,
|
756 |
+
"subscribe",
|
757 |
+
"<bold>subscribe</bold>",
|
758 |
+
"%%sub%%"
|
759 |
+
);
|
760 |
+
$email->setGanalytics(
|
761 |
+
true,
|
762 |
+
"utm_source",
|
763 |
+
"utm_medium",
|
764 |
+
"utm_term",
|
765 |
+
"utm_content",
|
766 |
+
"utm_campaign"
|
767 |
+
);
|
768 |
+
|
769 |
+
$json = json_encode($email->jsonSerialize());
|
770 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT_DYNAMIC);
|
771 |
+
$this->assertTrue($isEqual);
|
772 |
+
}
|
773 |
+
|
774 |
+
|
775 |
+
/**
|
776 |
+
* Test all parameters using objects
|
777 |
+
*/
|
778 |
+
public function testKitchenSinkExampleWithObjects()
|
779 |
+
{
|
780 |
+
$email = new \SendGrid\Mail\Mail();
|
781 |
+
|
782 |
+
// For a detailed description of each of these settings,
|
783 |
+
// please see the
|
784 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
785 |
+
$email->setSubject(
|
786 |
+
new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun 2")
|
787 |
+
);
|
788 |
+
|
789 |
+
$email->addTo(new \SendGrid\Mail\To("test@example.com", "Example User"));
|
790 |
+
$email->addTo(new \SendGrid\Mail\To("test+1@example.com", "Example User1"));
|
791 |
+
$toEmails = [
|
792 |
+
new \SendGrid\Mail\To("test+2@example.com", "Example User2"),
|
793 |
+
new \SendGrid\Mail\To("test+3@example.com", "Example User3")
|
794 |
+
];
|
795 |
+
$email->addTos($toEmails);
|
796 |
+
|
797 |
+
$email->addCc(new \SendGrid\Mail\Cc("test+4@example.com", "Example User4"));
|
798 |
+
$ccEmails = [
|
799 |
+
new \SendGrid\Mail\Cc("test+5@example.com", "Example User5"),
|
800 |
+
new \SendGrid\Mail\Cc("test+6@example.com", "Example User6")
|
801 |
+
];
|
802 |
+
$email->addCcs($ccEmails);
|
803 |
+
|
804 |
+
$email->addBcc(
|
805 |
+
new \SendGrid\Mail\Bcc("test+7@example.com", "Example User7")
|
806 |
+
);
|
807 |
+
$bccEmails = [
|
808 |
+
new \SendGrid\Mail\Bcc("test+8@example.com", "Example User8"),
|
809 |
+
new \SendGrid\Mail\Bcc("test+9@example.com", "Example User9")
|
810 |
+
];
|
811 |
+
$email->addBccs($bccEmails);
|
812 |
+
|
813 |
+
$email->addHeader(new \SendGrid\Mail\Header("X-Test1", "Test1"));
|
814 |
+
$email->addHeader(new \SendGrid\Mail\Header("X-Test2", "Test2"));
|
815 |
+
$headers = [
|
816 |
+
new \SendGrid\Mail\Header("X-Test3", "Test3"),
|
817 |
+
new \SendGrid\Mail\Header("X-Test4", "Test4")
|
818 |
+
];
|
819 |
+
$email->addHeaders($headers);
|
820 |
+
|
821 |
+
$email->addSubstitution(
|
822 |
+
new \SendGrid\Mail\Substitution("%name1%", "Example Name 1")
|
823 |
+
);
|
824 |
+
$email->addSubstitution(
|
825 |
+
new \SendGrid\Mail\Substitution("%city1%", "Denver")
|
826 |
+
);
|
827 |
+
$substitutions = [
|
828 |
+
new \SendGrid\Mail\Substitution("%name2%", "Example Name 2"),
|
829 |
+
new \SendGrid\Mail\Substitution("%city2%", "Orange")
|
830 |
+
];
|
831 |
+
$email->addSubstitutions($substitutions);
|
832 |
+
|
833 |
+
$email->addCustomArg(new \SendGrid\Mail\CustomArg("marketing1", "false"));
|
834 |
+
$email->addCustomArg(new \SendGrid\Mail\CustomArg("transactional1", "true"));
|
835 |
+
$email->addCustomArg(new \SendGrid\Mail\CustomArg("category", "name"));
|
836 |
+
$customArgs = [
|
837 |
+
new \SendGrid\Mail\CustomArg("marketing2", "true"),
|
838 |
+
new \SendGrid\Mail\CustomArg("transactional2", "false"),
|
839 |
+
new \SendGrid\Mail\CustomArg("category", "name")
|
840 |
+
];
|
841 |
+
$email->addCustomArgs($customArgs);
|
842 |
+
|
843 |
+
$email->setSendAt(new \SendGrid\Mail\SendAt(1461775051));
|
844 |
+
|
845 |
+
// The values below this comment are global to entire message
|
846 |
+
|
847 |
+
$email->setFrom(new \SendGrid\Mail\From("test@example.com", "DX"));
|
848 |
+
|
849 |
+
$email->setGlobalSubject(
|
850 |
+
new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun and Global 2")
|
851 |
+
);
|
852 |
+
|
853 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
854 |
+
"and easy to do anywhere, even with PHP"
|
855 |
+
);
|
856 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
857 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
858 |
+
);
|
859 |
+
$email->addContent($plainTextContent);
|
860 |
+
$email->addContent($htmlContent);
|
861 |
+
$contents = [
|
862 |
+
new \SendGrid\Mail\Content("text/calendar", "Party Time!!"),
|
863 |
+
new \SendGrid\Mail\Content("text/calendar2", "Party Time 2!!")
|
864 |
+
];
|
865 |
+
$email->addContents($contents);
|
866 |
+
|
867 |
+
$email->addAttachment(
|
868 |
+
new \SendGrid\Mail\Attachment(
|
869 |
+
"base64 encoded content1",
|
870 |
+
"image/png",
|
871 |
+
"banner.png",
|
872 |
+
"inline",
|
873 |
+
"Banner"
|
874 |
+
)
|
875 |
+
);
|
876 |
+
$attachments = [
|
877 |
+
new \SendGrid\Mail\Attachment(
|
878 |
+
"base64 encoded content2",
|
879 |
+
"banner2.jpeg",
|
880 |
+
"image/jpeg",
|
881 |
+
"attachment",
|
882 |
+
"Banner 3"
|
883 |
+
),
|
884 |
+
new \SendGrid\Mail\Attachment(
|
885 |
+
"base64 encoded content3",
|
886 |
+
"banner3.gif",
|
887 |
+
"image/gif",
|
888 |
+
"inline",
|
889 |
+
"Banner 3"
|
890 |
+
)
|
891 |
+
];
|
892 |
+
$email->addAttachments($attachments);
|
893 |
+
|
894 |
+
$email->setTemplateId(
|
895 |
+
new \SendGrid\Mail\TemplateId("13b8f94f-bcae-4ec6-b752-70d6cb59f932")
|
896 |
+
);
|
897 |
+
|
898 |
+
$email->addGlobalHeader(new \SendGrid\Mail\Header("X-Day", "Monday"));
|
899 |
+
$globalHeaders = [
|
900 |
+
new \SendGrid\Mail\Header("X-Month", "January"),
|
901 |
+
new \SendGrid\Mail\Header("X-Year", "2017")
|
902 |
+
];
|
903 |
+
$email->addGlobalHeaders($globalHeaders);
|
904 |
+
|
905 |
+
$email->addSection(
|
906 |
+
new \SendGrid\Mail\Section(
|
907 |
+
"%section1%",
|
908 |
+
"Substitution for Section 1 Tag"
|
909 |
+
)
|
910 |
+
);
|
911 |
+
|
912 |
+
$sections = [
|
913 |
+
new \SendGrid\Mail\Section(
|
914 |
+
"%section3%",
|
915 |
+
"Substitution for Section 3 Tag"
|
916 |
+
),
|
917 |
+
new \SendGrid\Mail\Section(
|
918 |
+
"%section4%",
|
919 |
+
"Substitution for Section 4 Tag"
|
920 |
+
)
|
921 |
+
];
|
922 |
+
$email->addSections($sections);
|
923 |
+
|
924 |
+
$email->addCategory(new \SendGrid\Mail\Category("Category 1"));
|
925 |
+
$categories = [
|
926 |
+
new \SendGrid\Mail\Category("Category 2"),
|
927 |
+
new \SendGrid\Mail\Category("Category 3")
|
928 |
+
];
|
929 |
+
$email->addCategories($categories);
|
930 |
+
|
931 |
+
$email->setBatchId(
|
932 |
+
new \SendGrid\Mail\BatchId(
|
933 |
+
"MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw"
|
934 |
+
)
|
935 |
+
);
|
936 |
+
|
937 |
+
$email->setReplyTo(
|
938 |
+
new \SendGrid\Mail\ReplyTo(
|
939 |
+
"dx+replyto2@example.com",
|
940 |
+
"DX Team Reply To 2"
|
941 |
+
)
|
942 |
+
);
|
943 |
+
|
944 |
+
$asm = new \SendGrid\Mail\Asm(
|
945 |
+
new \SendGrid\Mail\GroupId(1),
|
946 |
+
new \SendGrid\Mail\GroupsToDisplay([1, 2, 3, 4])
|
947 |
+
);
|
948 |
+
$email->setAsm($asm);
|
949 |
+
|
950 |
+
$email->setIpPoolName(new \SendGrid\Mail\IpPoolName("23"));
|
951 |
+
|
952 |
+
$mail_settings = new \SendGrid\Mail\MailSettings();
|
953 |
+
$mail_settings->setBccSettings(
|
954 |
+
new \SendGrid\Mail\BccSettings(true, "bcc@example.com")
|
955 |
+
);
|
956 |
+
$mail_settings->setBypassListManagement(
|
957 |
+
new \SendGrid\Mail\BypassListManagement(true)
|
958 |
+
);
|
959 |
+
$mail_settings->setFooter(
|
960 |
+
new \SendGrid\Mail\Footer(true, "Footer", "<strong>Footer</strong>")
|
961 |
+
);
|
962 |
+
$mail_settings->setSandBoxMode(new \SendGrid\Mail\SandBoxMode(true));
|
963 |
+
$mail_settings->setSpamCheck(
|
964 |
+
new \SendGrid\Mail\SpamCheck(true, 1, "http://mydomain.com")
|
965 |
+
);
|
966 |
+
$email->setMailSettings($mail_settings);
|
967 |
+
|
968 |
+
$tracking_settings = new \SendGrid\Mail\TrackingSettings();
|
969 |
+
$tracking_settings->setClickTracking(
|
970 |
+
new \SendGrid\Mail\ClickTracking(true, true)
|
971 |
+
);
|
972 |
+
$tracking_settings->setOpenTracking(
|
973 |
+
new \SendGrid\Mail\OpenTracking(true, "--sub--")
|
974 |
+
);
|
975 |
+
$tracking_settings->setSubscriptionTracking(
|
976 |
+
new \SendGrid\Mail\SubscriptionTracking(
|
977 |
+
true,
|
978 |
+
"subscribe",
|
979 |
+
"<bold>subscribe</bold>",
|
980 |
+
"%%sub%%"
|
981 |
+
)
|
982 |
+
);
|
983 |
+
$tracking_settings->setGanalytics(
|
984 |
+
new \SendGrid\Mail\Ganalytics(
|
985 |
+
true,
|
986 |
+
"utm_source",
|
987 |
+
"utm_medium",
|
988 |
+
"utm_term",
|
989 |
+
"utm_content",
|
990 |
+
"utm_campaign"
|
991 |
+
)
|
992 |
+
);
|
993 |
+
$email->setTrackingSettings($tracking_settings);
|
994 |
+
|
995 |
+
$json = json_encode($email->jsonSerialize());
|
996 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
997 |
+
$this->assertTrue($isEqual);
|
998 |
+
}
|
999 |
+
|
1000 |
+
/**
|
1001 |
+
* Test all parameters using objects with dynamic templates
|
1002 |
+
*/
|
1003 |
+
public function testKitchenSinkExampleWithObjectsWithDynamicTemplate()
|
1004 |
+
{
|
1005 |
+
$email = new \SendGrid\Mail\Mail();
|
1006 |
+
|
1007 |
+
// For a detailed description of each of these settings,
|
1008 |
+
// please see the
|
1009 |
+
// [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
1010 |
+
$email->setSubject(
|
1011 |
+
new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun 2")
|
1012 |
+
);
|
1013 |
+
|
1014 |
+
$email->addTo(new \SendGrid\Mail\To("test@example.com", "Example User"));
|
1015 |
+
$email->addTo(new \SendGrid\Mail\To("test+1@example.com", "Example User1"));
|
1016 |
+
$toEmails = [
|
1017 |
+
new \SendGrid\Mail\To("test+2@example.com", "Example User2"),
|
1018 |
+
new \SendGrid\Mail\To("test+3@example.com", "Example User3")
|
1019 |
+
];
|
1020 |
+
$email->addTos($toEmails);
|
1021 |
+
|
1022 |
+
$email->addCc(new \SendGrid\Mail\Cc("test+4@example.com", "Example User4"));
|
1023 |
+
$ccEmails = [
|
1024 |
+
new \SendGrid\Mail\Cc("test+5@example.com", "Example User5"),
|
1025 |
+
new \SendGrid\Mail\Cc("test+6@example.com", "Example User6")
|
1026 |
+
];
|
1027 |
+
$email->addCcs($ccEmails);
|
1028 |
+
|
1029 |
+
$email->addBcc(
|
1030 |
+
new \SendGrid\Mail\Bcc("test+7@example.com", "Example User7")
|
1031 |
+
);
|
1032 |
+
$bccEmails = [
|
1033 |
+
new \SendGrid\Mail\Bcc("test+8@example.com", "Example User8"),
|
1034 |
+
new \SendGrid\Mail\Bcc("test+9@example.com", "Example User9")
|
1035 |
+
];
|
1036 |
+
$email->addBccs($bccEmails);
|
1037 |
+
|
1038 |
+
$email->addHeader(new \SendGrid\Mail\Header("X-Test1", "Test1"));
|
1039 |
+
$email->addHeader(new \SendGrid\Mail\Header("X-Test2", "Test2"));
|
1040 |
+
$headers = [
|
1041 |
+
new \SendGrid\Mail\Header("X-Test3", "Test3"),
|
1042 |
+
new \SendGrid\Mail\Header("X-Test4", "Test4")
|
1043 |
+
];
|
1044 |
+
$email->addHeaders($headers);
|
1045 |
+
|
1046 |
+
$email->addDynamicTemplateData(
|
1047 |
+
new \SendGrid\Mail\Substitution('object', [
|
1048 |
+
'key1' => 'Key 1',
|
1049 |
+
'key2' => 'Key 2',
|
1050 |
+
])
|
1051 |
+
);
|
1052 |
+
$email->addDynamicTemplateData(
|
1053 |
+
new \SendGrid\Mail\Substitution('boolean', false)
|
1054 |
+
);
|
1055 |
+
$email->addDynamicTemplateDatas([
|
1056 |
+
new \SendGrid\Mail\Substitution('array', [
|
1057 |
+
'index0',
|
1058 |
+
'index1',
|
1059 |
+
]),
|
1060 |
+
new \SendGrid\Mail\Substitution('number', 1),
|
1061 |
+
]);
|
1062 |
+
|
1063 |
+
$email->addCustomArg(new \SendGrid\Mail\CustomArg("marketing1", "false"));
|
1064 |
+
$email->addCustomArg(new \SendGrid\Mail\CustomArg("transactional1", "true"));
|
1065 |
+
$email->addCustomArg(new \SendGrid\Mail\CustomArg("category", "name"));
|
1066 |
+
$customArgs = [
|
1067 |
+
new \SendGrid\Mail\CustomArg("marketing2", "true"),
|
1068 |
+
new \SendGrid\Mail\CustomArg("transactional2", "false"),
|
1069 |
+
new \SendGrid\Mail\CustomArg("category", "name")
|
1070 |
+
];
|
1071 |
+
$email->addCustomArgs($customArgs);
|
1072 |
+
|
1073 |
+
$email->setSendAt(new \SendGrid\Mail\SendAt(1461775051));
|
1074 |
+
|
1075 |
+
// The values below this comment are global to entire message
|
1076 |
+
|
1077 |
+
$email->setFrom(new \SendGrid\Mail\From("test@example.com", "DX"));
|
1078 |
+
|
1079 |
+
$email->setGlobalSubject(
|
1080 |
+
new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun and Global 2")
|
1081 |
+
);
|
1082 |
+
|
1083 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
1084 |
+
"and easy to do anywhere, even with PHP"
|
1085 |
+
);
|
1086 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
1087 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
1088 |
+
);
|
1089 |
+
$email->addContent($plainTextContent);
|
1090 |
+
$email->addContent($htmlContent);
|
1091 |
+
$contents = [
|
1092 |
+
new \SendGrid\Mail\Content("text/calendar", "Party Time!!"),
|
1093 |
+
new \SendGrid\Mail\Content("text/calendar2", "Party Time 2!!")
|
1094 |
+
];
|
1095 |
+
$email->addContents($contents);
|
1096 |
+
|
1097 |
+
$email->addAttachment(
|
1098 |
+
new \SendGrid\Mail\Attachment(
|
1099 |
+
"base64 encoded content1",
|
1100 |
+
"image/png",
|
1101 |
+
"banner.png",
|
1102 |
+
"inline",
|
1103 |
+
"Banner"
|
1104 |
+
)
|
1105 |
+
);
|
1106 |
+
$attachments = [
|
1107 |
+
new \SendGrid\Mail\Attachment(
|
1108 |
+
"base64 encoded content2",
|
1109 |
+
"banner2.jpeg",
|
1110 |
+
"image/jpeg",
|
1111 |
+
"attachment",
|
1112 |
+
"Banner 3"
|
1113 |
+
),
|
1114 |
+
new \SendGrid\Mail\Attachment(
|
1115 |
+
"base64 encoded content3",
|
1116 |
+
"banner3.gif",
|
1117 |
+
"image/gif",
|
1118 |
+
"inline",
|
1119 |
+
"Banner 3"
|
1120 |
+
)
|
1121 |
+
];
|
1122 |
+
$email->addAttachments($attachments);
|
1123 |
+
|
1124 |
+
$email->setTemplateId(
|
1125 |
+
new \SendGrid\Mail\TemplateId("d-13b8f94fbcae4ec6b75270d6cb59f932")
|
1126 |
+
);
|
1127 |
+
|
1128 |
+
$email->addGlobalHeader(new \SendGrid\Mail\Header("X-Day", "Monday"));
|
1129 |
+
$globalHeaders = [
|
1130 |
+
new \SendGrid\Mail\Header("X-Month", "January"),
|
1131 |
+
new \SendGrid\Mail\Header("X-Year", "2017")
|
1132 |
+
];
|
1133 |
+
$email->addGlobalHeaders($globalHeaders);
|
1134 |
+
|
1135 |
+
$email->addSection(
|
1136 |
+
new \SendGrid\Mail\Section(
|
1137 |
+
"%section1%",
|
1138 |
+
"Substitution for Section 1 Tag"
|
1139 |
+
)
|
1140 |
+
);
|
1141 |
+
|
1142 |
+
$sections = [
|
1143 |
+
new \SendGrid\Mail\Section(
|
1144 |
+
"%section3%",
|
1145 |
+
"Substitution for Section 3 Tag"
|
1146 |
+
),
|
1147 |
+
new \SendGrid\Mail\Section(
|
1148 |
+
"%section4%",
|
1149 |
+
"Substitution for Section 4 Tag"
|
1150 |
+
)
|
1151 |
+
];
|
1152 |
+
$email->addSections($sections);
|
1153 |
+
|
1154 |
+
$email->addCategory(new \SendGrid\Mail\Category("Category 1"));
|
1155 |
+
$categories = [
|
1156 |
+
new \SendGrid\Mail\Category("Category 2"),
|
1157 |
+
new \SendGrid\Mail\Category("Category 3")
|
1158 |
+
];
|
1159 |
+
$email->addCategories($categories);
|
1160 |
+
|
1161 |
+
$email->setBatchId(
|
1162 |
+
new \SendGrid\Mail\BatchId(
|
1163 |
+
"MWQxZmIyODYtNjE1Ni0xMWU1LWI3ZTUtMDgwMDI3OGJkMmY2LWEzMmViMjYxMw"
|
1164 |
+
)
|
1165 |
+
);
|
1166 |
+
|
1167 |
+
$email->setReplyTo(
|
1168 |
+
new \SendGrid\Mail\ReplyTo(
|
1169 |
+
"dx+replyto2@example.com",
|
1170 |
+
"DX Team Reply To 2"
|
1171 |
+
)
|
1172 |
+
);
|
1173 |
+
|
1174 |
+
$asm = new \SendGrid\Mail\Asm(
|
1175 |
+
new \SendGrid\Mail\GroupId(1),
|
1176 |
+
new \SendGrid\Mail\GroupsToDisplay([1, 2, 3, 4])
|
1177 |
+
);
|
1178 |
+
$email->setAsm($asm);
|
1179 |
+
|
1180 |
+
$email->setIpPoolName(new \SendGrid\Mail\IpPoolName("23"));
|
1181 |
+
|
1182 |
+
$mail_settings = new \SendGrid\Mail\MailSettings();
|
1183 |
+
$mail_settings->setBccSettings(
|
1184 |
+
new \SendGrid\Mail\BccSettings(true, "bcc@example.com")
|
1185 |
+
);
|
1186 |
+
$mail_settings->setBypassListManagement(
|
1187 |
+
new \SendGrid\Mail\BypassListManagement(true)
|
1188 |
+
);
|
1189 |
+
$mail_settings->setFooter(
|
1190 |
+
new \SendGrid\Mail\Footer(true, "Footer", "<strong>Footer</strong>")
|
1191 |
+
);
|
1192 |
+
$mail_settings->setSandBoxMode(new \SendGrid\Mail\SandBoxMode(true));
|
1193 |
+
$mail_settings->setSpamCheck(
|
1194 |
+
new \SendGrid\Mail\SpamCheck(true, 1, "http://mydomain.com")
|
1195 |
+
);
|
1196 |
+
$email->setMailSettings($mail_settings);
|
1197 |
+
|
1198 |
+
$tracking_settings = new \SendGrid\Mail\TrackingSettings();
|
1199 |
+
$tracking_settings->setClickTracking(
|
1200 |
+
new \SendGrid\Mail\ClickTracking(true, true)
|
1201 |
+
);
|
1202 |
+
$tracking_settings->setOpenTracking(
|
1203 |
+
new \SendGrid\Mail\OpenTracking(true, "--sub--")
|
1204 |
+
);
|
1205 |
+
$tracking_settings->setSubscriptionTracking(
|
1206 |
+
new \SendGrid\Mail\SubscriptionTracking(
|
1207 |
+
true,
|
1208 |
+
"subscribe",
|
1209 |
+
"<bold>subscribe</bold>",
|
1210 |
+
"%%sub%%"
|
1211 |
+
)
|
1212 |
+
);
|
1213 |
+
$tracking_settings->setGanalytics(
|
1214 |
+
new \SendGrid\Mail\Ganalytics(
|
1215 |
+
true,
|
1216 |
+
"utm_source",
|
1217 |
+
"utm_medium",
|
1218 |
+
"utm_term",
|
1219 |
+
"utm_content",
|
1220 |
+
"utm_campaign"
|
1221 |
+
)
|
1222 |
+
);
|
1223 |
+
$email->setTrackingSettings($tracking_settings);
|
1224 |
+
|
1225 |
+
$json = json_encode($email->jsonSerialize());
|
1226 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT_DYNAMIC);
|
1227 |
+
$this->assertTrue($isEqual);
|
1228 |
+
}
|
1229 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/MailGetContentsTest.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace SendGrid\Tests;
|
4 |
+
|
5 |
+
use PHPUnit\Framework\TestCase;
|
6 |
+
use SendGrid\Mail\Mail;
|
7 |
+
use SendGrid\Mail\Content;
|
8 |
+
use SendGrid\Mail\EmailAddress;
|
9 |
+
use SendGrid\Mail\From;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* This class tests the getContents() function in SendGrid\Mail\Mail
|
13 |
+
*
|
14 |
+
* @package SendGrid\Tests
|
15 |
+
*/
|
16 |
+
class MailGetContentsTest extends TestCase
|
17 |
+
{
|
18 |
+
|
19 |
+
/**
|
20 |
+
* This method tests that array from Mail getContents() returns with
|
21 |
+
* text/plain Content object first when Mail instantiated with text/html
|
22 |
+
* content before text/plain
|
23 |
+
*
|
24 |
+
* @return null
|
25 |
+
*/
|
26 |
+
public function testWillReturnPlainContentFirst()
|
27 |
+
{
|
28 |
+
$email = new \SendGrid\Mail\Mail();
|
29 |
+
$email->setFrom("test@example.com", null);
|
30 |
+
$email->setSubject("Hello World from the Twilio SendGrid PHP Library");
|
31 |
+
$email->addTo("test@example.com", "Test Person");
|
32 |
+
|
33 |
+
$email->addContent("text/html", "<p>some text here</p>");
|
34 |
+
$email->addContent("text/plain", "some text here");
|
35 |
+
|
36 |
+
$this->assertEquals('text/plain', $email->getContents()[0]->getType());
|
37 |
+
}
|
38 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/MailHelperTest.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests email address encoding
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
use SendGrid\Mail\EmailAddress as EmailAddress;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* This class tests email address encoding
|
21 |
+
*
|
22 |
+
* @package SendGrid\Tests
|
23 |
+
*/
|
24 |
+
class MailTest_Mail extends \PHPUnit\Framework\TestCase
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* This method tests various types of unencoded emails
|
28 |
+
*
|
29 |
+
* @expectedException \SendGrid\Mail\TypeException
|
30 |
+
*/
|
31 |
+
public function testEmailName()
|
32 |
+
{
|
33 |
+
$email = new EmailAddress('test@example.com', 'John Doe');
|
34 |
+
$json = json_encode($email->jsonSerialize());
|
35 |
+
$this->assertEquals($json, '{"name":"John Doe","email":"test@example.com"}');
|
36 |
+
|
37 |
+
$email->setName('');
|
38 |
+
$json = json_encode($email->jsonSerialize());
|
39 |
+
$this->assertEquals($json, '{"email":"test@example.com"}');
|
40 |
+
|
41 |
+
$email->setName(null);
|
42 |
+
$json = json_encode($email->jsonSerialize());
|
43 |
+
$this->assertEquals($json, '{"email":"test@example.com"}');
|
44 |
+
|
45 |
+
$email->setName('Doe, John');
|
46 |
+
$json = json_encode($email->jsonSerialize());
|
47 |
+
$this->assertEquals(
|
48 |
+
$json,
|
49 |
+
'{"name":"\\"Doe, John\\"","email":"test@example.com"}'
|
50 |
+
);
|
51 |
+
|
52 |
+
$email->setName('Doe; John');
|
53 |
+
$json = json_encode($email->jsonSerialize());
|
54 |
+
$this->assertEquals(
|
55 |
+
$json,
|
56 |
+
'{"name":"\\"Doe; John\\"","email":"test@example.com"}'
|
57 |
+
);
|
58 |
+
|
59 |
+
$email->setName('John "Billy" O\'Keeffe');
|
60 |
+
$json = json_encode($email->jsonSerialize());
|
61 |
+
$this->assertEquals(
|
62 |
+
$json,
|
63 |
+
'{"name":"John \\"Billy\\" O\'Keeffe","email":"test@example.com"}'
|
64 |
+
);
|
65 |
+
|
66 |
+
$email->setName('O\'Keeffe, John "Billy"');
|
67 |
+
$json = json_encode($email->jsonSerialize());
|
68 |
+
$this->assertEquals(
|
69 |
+
$json,
|
70 |
+
'{"name":"\\"O\'Keeffe, John \\\\\\"Billy\\\\\\"\\"","email":"test@example.com"}'
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* This method tests TypeException for wrong email address
|
76 |
+
*
|
77 |
+
* @expectedException \SendGrid\Mail\TypeException
|
78 |
+
*/
|
79 |
+
public function testEmailAddress()
|
80 |
+
{
|
81 |
+
$email = new EmailAddress();
|
82 |
+
$email->setEmailAddress('test@example.com@wrong');
|
83 |
+
}
|
84 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/MultipleEmailToMultipleRecipientsTest.php
ADDED
@@ -0,0 +1,517 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the request object generation for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class tests the request object generation for a /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Tests
|
21 |
+
*/
|
22 |
+
class MultipleEmailToMulipleRecipientsTest extends BaseTestClass
|
23 |
+
{
|
24 |
+
|
25 |
+
private $REQUEST_OBJECT = <<<'JSON'
|
26 |
+
{
|
27 |
+
"content": [
|
28 |
+
{
|
29 |
+
"type": "text/plain",
|
30 |
+
"value": "Hello -name-, your github is -github- sent at -time-"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"type": "text/html",
|
34 |
+
"value": "<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
35 |
+
}
|
36 |
+
],
|
37 |
+
"from": {
|
38 |
+
"email": "test@example.com",
|
39 |
+
"name": "Example User"
|
40 |
+
},
|
41 |
+
"personalizations": [
|
42 |
+
{
|
43 |
+
"subject": "Subject 1 -name-",
|
44 |
+
"substitutions": {
|
45 |
+
"-github-": "http://github.com/example_user1",
|
46 |
+
"-name-": "Example User 1",
|
47 |
+
"-time-": "2018-05-03 23:10:29"
|
48 |
+
},
|
49 |
+
"to": [
|
50 |
+
{
|
51 |
+
"email": "test+test1@example.com",
|
52 |
+
"name": "Example User1"
|
53 |
+
}
|
54 |
+
]
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"subject": "Subject 2 -name-",
|
58 |
+
"substitutions": {
|
59 |
+
"-github-": "http://github.com/example_user2",
|
60 |
+
"-name-": "Example User 2",
|
61 |
+
"-time-": "2018-05-03 23:10:29"
|
62 |
+
},
|
63 |
+
"to": [
|
64 |
+
{
|
65 |
+
"email": "test+test2@example.com",
|
66 |
+
"name": "Example User2"
|
67 |
+
}
|
68 |
+
]
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"substitutions": {
|
72 |
+
"-github-": "http://github.com/example_user3",
|
73 |
+
"-name-": "Example User 3",
|
74 |
+
"-time-": "2018-05-03 23:10:29"
|
75 |
+
},
|
76 |
+
"to": [
|
77 |
+
{
|
78 |
+
"email": "test+test3@example.com",
|
79 |
+
"name": "Example User3"
|
80 |
+
}
|
81 |
+
]
|
82 |
+
}
|
83 |
+
],
|
84 |
+
"subject": "Hi -name-!"
|
85 |
+
}
|
86 |
+
JSON;
|
87 |
+
|
88 |
+
private $REQUEST_OBJECT_2 = <<<'JSON'
|
89 |
+
{
|
90 |
+
"content": [
|
91 |
+
{
|
92 |
+
"type": "text/plain",
|
93 |
+
"value": "Hello -name-, your github is -github- sent at -time-"
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"type": "text/html",
|
97 |
+
"value": "<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
98 |
+
}
|
99 |
+
],
|
100 |
+
"from": {
|
101 |
+
"email": "test@example.com",
|
102 |
+
"name": "Example User"
|
103 |
+
},
|
104 |
+
"personalizations": [
|
105 |
+
{
|
106 |
+
"subject": "Subject 1 -name-",
|
107 |
+
"substitutions": {
|
108 |
+
"-github-": "http://github.com/example_user1",
|
109 |
+
"-name-": "Example User 1",
|
110 |
+
"-time-": "2018-05-03 23:10:29"
|
111 |
+
},
|
112 |
+
"to": [
|
113 |
+
{
|
114 |
+
"email": "test+test1@example.com",
|
115 |
+
"name": "Example User1"
|
116 |
+
}
|
117 |
+
]
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"subject": "Subject 2 -name-",
|
121 |
+
"substitutions": {
|
122 |
+
"-github-": "http://github.com/example_user2",
|
123 |
+
"-name-": "Example User 2",
|
124 |
+
"-time-": "2018-05-03 23:10:29"
|
125 |
+
},
|
126 |
+
"to": [
|
127 |
+
{
|
128 |
+
"email": "test+test2@example.com",
|
129 |
+
"name": "Example User2"
|
130 |
+
}
|
131 |
+
]
|
132 |
+
},
|
133 |
+
{
|
134 |
+
"substitutions": {
|
135 |
+
"-github-": "http://github.com/example_user3",
|
136 |
+
"-name-": "Example User 3",
|
137 |
+
"-time-": "2018-05-03 23:10:29"
|
138 |
+
},
|
139 |
+
"to": [
|
140 |
+
{
|
141 |
+
"email": "test+test3@example.com",
|
142 |
+
"name": "Example User3"
|
143 |
+
}
|
144 |
+
]
|
145 |
+
}
|
146 |
+
]
|
147 |
+
}
|
148 |
+
JSON;
|
149 |
+
|
150 |
+
private $REQUEST_OBJECT_3 = <<<'JSON'
|
151 |
+
{
|
152 |
+
"content": [
|
153 |
+
{
|
154 |
+
"type": "text/plain",
|
155 |
+
"value": "Hello -name-, your github is -github- sent at -time-"
|
156 |
+
},
|
157 |
+
{
|
158 |
+
"type": "text/html",
|
159 |
+
"value": "<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
160 |
+
}
|
161 |
+
],
|
162 |
+
"from": {
|
163 |
+
"email": "test@example.com",
|
164 |
+
"name": "Example User"
|
165 |
+
},
|
166 |
+
"personalizations": [
|
167 |
+
{
|
168 |
+
"subject": "Subject 1 -name-",
|
169 |
+
"dynamic_template_data": {
|
170 |
+
"-github-": "http://github.com/example_user1",
|
171 |
+
"-name-": "Example User 1",
|
172 |
+
"-time-": "2018-05-03 23:10:29"
|
173 |
+
},
|
174 |
+
"to": [
|
175 |
+
{
|
176 |
+
"email": "test+test1@example.com",
|
177 |
+
"name": "Example User1"
|
178 |
+
}
|
179 |
+
]
|
180 |
+
},
|
181 |
+
{
|
182 |
+
"subject": "Subject 2 -name-",
|
183 |
+
"dynamic_template_data": {
|
184 |
+
"-github-": "http://github.com/example_user2",
|
185 |
+
"-name-": "Example User 2",
|
186 |
+
"-time-": "2018-05-03 23:10:29"
|
187 |
+
},
|
188 |
+
"to": [
|
189 |
+
{
|
190 |
+
"email": "test+test2@example.com",
|
191 |
+
"name": "Example User2"
|
192 |
+
}
|
193 |
+
]
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"dynamic_template_data": {
|
197 |
+
"-github-": "http://github.com/example_user3",
|
198 |
+
"-name-": "Example User 3",
|
199 |
+
"-time-": "2018-05-03 23:10:29"
|
200 |
+
},
|
201 |
+
"to": [
|
202 |
+
{
|
203 |
+
"email": "test+test3@example.com",
|
204 |
+
"name": "Example User3"
|
205 |
+
}
|
206 |
+
]
|
207 |
+
}
|
208 |
+
],
|
209 |
+
"template_id": "d-13b8f94f-bcae-4ec6-b752-70d6cb59f932",
|
210 |
+
"subject": "Hi -name-!"
|
211 |
+
}
|
212 |
+
JSON;
|
213 |
+
|
214 |
+
private $REQUEST_OBJECT_4 = <<<'JSON'
|
215 |
+
{
|
216 |
+
"content": [
|
217 |
+
{
|
218 |
+
"type": "text/plain",
|
219 |
+
"value": "Hello -name-, your github is -github- sent at -time-"
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"type": "text/html",
|
223 |
+
"value": "<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
224 |
+
}
|
225 |
+
],
|
226 |
+
"from": {
|
227 |
+
"email": "test@example.com",
|
228 |
+
"name": "Example User"
|
229 |
+
},
|
230 |
+
"personalizations": [
|
231 |
+
{
|
232 |
+
"subject": "Subject 1 -name-",
|
233 |
+
"dynamic_template_data": {
|
234 |
+
"-github-": "http://github.com/example_user1",
|
235 |
+
"-name-": "Example User 1",
|
236 |
+
"-time-": "2018-05-03 23:10:29"
|
237 |
+
},
|
238 |
+
"to": [
|
239 |
+
{
|
240 |
+
"email": "test+test1@example.com",
|
241 |
+
"name": "Example User1"
|
242 |
+
}
|
243 |
+
]
|
244 |
+
},
|
245 |
+
{
|
246 |
+
"subject": "Subject 2 -name-",
|
247 |
+
"dynamic_template_data": {
|
248 |
+
"-github-": "http://github.com/example_user2",
|
249 |
+
"-name-": "Example User 2",
|
250 |
+
"-time-": "2018-05-03 23:10:29"
|
251 |
+
},
|
252 |
+
"to": [
|
253 |
+
{
|
254 |
+
"email": "test+test2@example.com",
|
255 |
+
"name": "Example User2"
|
256 |
+
}
|
257 |
+
]
|
258 |
+
},
|
259 |
+
{
|
260 |
+
"dynamic_template_data": {
|
261 |
+
"-github-": "http://github.com/example_user3",
|
262 |
+
"-name-": "Example User 3",
|
263 |
+
"-time-": "2018-05-03 23:10:29"
|
264 |
+
},
|
265 |
+
"to": [
|
266 |
+
{
|
267 |
+
"email": "test+test3@example.com",
|
268 |
+
"name": "Example User3"
|
269 |
+
}
|
270 |
+
]
|
271 |
+
}
|
272 |
+
],
|
273 |
+
"template_id": "d-13b8f94f-bcae-4ec6-b752-70d6cb59f932"
|
274 |
+
}
|
275 |
+
JSON;
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Test when we have individual subjects for each Personalization object
|
279 |
+
*/
|
280 |
+
public function testWithIndividualSubjects()
|
281 |
+
{
|
282 |
+
$from = new \SendGrid\Mail\From("test@example.com", "Example User");
|
283 |
+
$tos = [
|
284 |
+
new \SendGrid\Mail\To(
|
285 |
+
"test+test1@example.com",
|
286 |
+
"Example User1",
|
287 |
+
[
|
288 |
+
'-name-' => 'Example User 1',
|
289 |
+
'-github-' => 'http://github.com/example_user1'
|
290 |
+
],
|
291 |
+
"Subject 1 -name-"
|
292 |
+
),
|
293 |
+
new \SendGrid\Mail\To(
|
294 |
+
"test+test2@example.com",
|
295 |
+
"Example User2",
|
296 |
+
[
|
297 |
+
'-name-' => 'Example User 2',
|
298 |
+
'-github-' => 'http://github.com/example_user2'
|
299 |
+
],
|
300 |
+
"Subject 2 -name-"
|
301 |
+
),
|
302 |
+
new \SendGrid\Mail\To(
|
303 |
+
"test+test3@example.com",
|
304 |
+
"Example User3",
|
305 |
+
[
|
306 |
+
'-name-' => 'Example User 3',
|
307 |
+
'-github-' => 'http://github.com/example_user3'
|
308 |
+
]
|
309 |
+
)
|
310 |
+
];
|
311 |
+
$subject = new \SendGrid\Mail\Subject("Hi -name-!"); // default subject
|
312 |
+
$globalSubstitutions = [
|
313 |
+
'-time-' => "2018-05-03 23:10:29"
|
314 |
+
];
|
315 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
316 |
+
"Hello -name-, your github is -github- sent at -time-"
|
317 |
+
);
|
318 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
319 |
+
"<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
320 |
+
);
|
321 |
+
$email = new \SendGrid\Mail\Mail(
|
322 |
+
$from,
|
323 |
+
$tos,
|
324 |
+
$subject, // or array of subjects, these take precendence
|
325 |
+
$plainTextContent,
|
326 |
+
$htmlContent,
|
327 |
+
$globalSubstitutions
|
328 |
+
);
|
329 |
+
$json = json_encode($email->jsonSerialize());
|
330 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
331 |
+
$this->assertTrue($isEqual);
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Test when we have individual subjects using dynamic templates for each Personalization object
|
336 |
+
*/
|
337 |
+
public function testWithIndividualSubjectsDynamicTemplates()
|
338 |
+
{
|
339 |
+
$from = new \SendGrid\Mail\From("test@example.com", "Example User");
|
340 |
+
$tos = [
|
341 |
+
new \SendGrid\Mail\To(
|
342 |
+
"test+test1@example.com",
|
343 |
+
"Example User1",
|
344 |
+
[
|
345 |
+
'-name-' => 'Example User 1',
|
346 |
+
'-github-' => 'http://github.com/example_user1'
|
347 |
+
],
|
348 |
+
"Subject 1 -name-"
|
349 |
+
),
|
350 |
+
new \SendGrid\Mail\To(
|
351 |
+
"test+test2@example.com",
|
352 |
+
"Example User2",
|
353 |
+
[
|
354 |
+
'-name-' => 'Example User 2',
|
355 |
+
'-github-' => 'http://github.com/example_user2'
|
356 |
+
],
|
357 |
+
"Subject 2 -name-"
|
358 |
+
),
|
359 |
+
new \SendGrid\Mail\To(
|
360 |
+
"test+test3@example.com",
|
361 |
+
"Example User3",
|
362 |
+
[
|
363 |
+
'-name-' => 'Example User 3',
|
364 |
+
'-github-' => 'http://github.com/example_user3'
|
365 |
+
]
|
366 |
+
)
|
367 |
+
];
|
368 |
+
$subject = new \SendGrid\Mail\Subject("Hi -name-!"); // default subject
|
369 |
+
$globalSubstitutions = [
|
370 |
+
'-time-' => "2018-05-03 23:10:29"
|
371 |
+
];
|
372 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
373 |
+
"Hello -name-, your github is -github- sent at -time-"
|
374 |
+
);
|
375 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
376 |
+
"<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
377 |
+
);
|
378 |
+
$email = new \SendGrid\Mail\Mail(
|
379 |
+
$from,
|
380 |
+
$tos,
|
381 |
+
$subject, // or array of subjects, these take precendence
|
382 |
+
$plainTextContent,
|
383 |
+
$htmlContent,
|
384 |
+
$globalSubstitutions
|
385 |
+
);
|
386 |
+
$email->setTemplateId("d-13b8f94f-bcae-4ec6-b752-70d6cb59f932");
|
387 |
+
$json = json_encode($email->jsonSerialize());
|
388 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT_3);
|
389 |
+
$this->assertTrue($isEqual);
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Test when we pass in an array of subjects
|
394 |
+
*
|
395 |
+
* @expectedException \SendGrid\Mail\TypeException
|
396 |
+
*/
|
397 |
+
public function testWithCollectionOfSubjects()
|
398 |
+
{
|
399 |
+
$from = new \SendGrid\Mail\From("test@example.com", "Example User");
|
400 |
+
$tos = [
|
401 |
+
new \SendGrid\Mail\To(
|
402 |
+
"test+test1@example.com",
|
403 |
+
"Example User1",
|
404 |
+
[
|
405 |
+
'-name-' => 'Example User 1',
|
406 |
+
'-github-' => 'http://github.com/example_user1'
|
407 |
+
],
|
408 |
+
"Example User1 -name-"
|
409 |
+
),
|
410 |
+
new \SendGrid\Mail\To(
|
411 |
+
"test+test2@example.com",
|
412 |
+
"Example User2",
|
413 |
+
[
|
414 |
+
'-name-' => 'Example User 2',
|
415 |
+
'-github-' => 'http://github.com/example_user2'
|
416 |
+
],
|
417 |
+
"Example User2 -name-"
|
418 |
+
),
|
419 |
+
new \SendGrid\Mail\To(
|
420 |
+
"test+test3@example.com",
|
421 |
+
"Example User3",
|
422 |
+
[
|
423 |
+
'-name-' => 'Example User 3',
|
424 |
+
'-github-' => 'http://github.com/example_user3'
|
425 |
+
]
|
426 |
+
)
|
427 |
+
];
|
428 |
+
$subject = [
|
429 |
+
"Subject 1 -name-",
|
430 |
+
"Subject 2 -name-"
|
431 |
+
];
|
432 |
+
$globalSubstitutions = [
|
433 |
+
'-time-' => "2018-05-03 23:10:29"
|
434 |
+
];
|
435 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
436 |
+
"Hello -name-, your github is -github- sent at -time-"
|
437 |
+
);
|
438 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
439 |
+
"<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
440 |
+
);
|
441 |
+
$email = new \SendGrid\Mail\Mail(
|
442 |
+
$from,
|
443 |
+
$tos,
|
444 |
+
$subject, // or array of subjects, these take precendence
|
445 |
+
$plainTextContent,
|
446 |
+
$htmlContent,
|
447 |
+
$globalSubstitutions
|
448 |
+
);
|
449 |
+
$json = json_encode($email->jsonSerialize());
|
450 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT_2);
|
451 |
+
$this->assertTrue($isEqual);
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Test when we pass in an array of subjects
|
456 |
+
*
|
457 |
+
* @expectedException \SendGrid\Mail\TypeException
|
458 |
+
*/
|
459 |
+
public function testWithCollectionOfSubjectsDynamic()
|
460 |
+
{
|
461 |
+
$from = new \SendGrid\Mail\From("test@example.com", "Example User");
|
462 |
+
$tos = [
|
463 |
+
new \SendGrid\Mail\To(
|
464 |
+
"test+test1@example.com",
|
465 |
+
"Example User1",
|
466 |
+
[
|
467 |
+
'-name-' => 'Example User 1',
|
468 |
+
'-github-' => 'http://github.com/example_user1'
|
469 |
+
],
|
470 |
+
"Example User1 -name-"
|
471 |
+
),
|
472 |
+
new \SendGrid\Mail\To(
|
473 |
+
"test+test2@example.com",
|
474 |
+
"Example User2",
|
475 |
+
[
|
476 |
+
'-name-' => 'Example User 2',
|
477 |
+
'-github-' => 'http://github.com/example_user2'
|
478 |
+
],
|
479 |
+
"Example User2 -name-"
|
480 |
+
),
|
481 |
+
new \SendGrid\Mail\To(
|
482 |
+
"test+test3@example.com",
|
483 |
+
"Example User3",
|
484 |
+
[
|
485 |
+
'-name-' => 'Example User 3',
|
486 |
+
'-github-' => 'http://github.com/example_user3'
|
487 |
+
]
|
488 |
+
)
|
489 |
+
];
|
490 |
+
$subject = [
|
491 |
+
"Subject 1 -name-",
|
492 |
+
"Subject 2 -name-"
|
493 |
+
];
|
494 |
+
$globalSubstitutions = [
|
495 |
+
'-time-' => "2018-05-03 23:10:29"
|
496 |
+
];
|
497 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
498 |
+
"Hello -name-, your github is -github- sent at -time-"
|
499 |
+
);
|
500 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
501 |
+
"<strong>Hello -name-, your github is <a href=\"-github-\">here</a></strong> sent at -time-"
|
502 |
+
);
|
503 |
+
$email = new \SendGrid\Mail\Mail(
|
504 |
+
$from,
|
505 |
+
$tos,
|
506 |
+
$subject, // or array of subjects, these take precendence
|
507 |
+
$plainTextContent,
|
508 |
+
$htmlContent,
|
509 |
+
$globalSubstitutions
|
510 |
+
);
|
511 |
+
$email->setTemplateId("d-13b8f94f-bcae-4ec6-b752-70d6cb59f932");
|
512 |
+
$json = json_encode($email->jsonSerialize());
|
513 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT_2);
|
514 |
+
$this->assertTrue($isEqual);
|
515 |
+
}
|
516 |
+
|
517 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SendGridTest.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the SendGrid Client
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class tests the Twilio SendGrid Client
|
19 |
+
*
|
20 |
+
* @package SendGrid\Tests
|
21 |
+
*/
|
22 |
+
class SendGridTest extends BaseTestClass
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Test if the version is correct
|
26 |
+
*/
|
27 |
+
public function testVersionIsCorrect()
|
28 |
+
{
|
29 |
+
$this->assertEquals(\SendGrid::VERSION, '7.3.0');
|
30 |
+
$version = json_decode(
|
31 |
+
file_get_contents(__DIR__ . '/../../composer.json')
|
32 |
+
)->version;
|
33 |
+
$this->assertEquals(
|
34 |
+
$version,
|
35 |
+
\SendGrid::VERSION
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Test that we can connect to the Twilio SendGrid API
|
41 |
+
*/
|
42 |
+
public function testCanConnectToSendGridApi()
|
43 |
+
{
|
44 |
+
$sg = new \SendGrid(self::$apiKey);
|
45 |
+
$headers = [
|
46 |
+
'Authorization: Bearer ' . self::$apiKey,
|
47 |
+
'User-Agent: sendgrid/' . $sg->version . ';php',
|
48 |
+
'Accept: application/json'
|
49 |
+
];
|
50 |
+
|
51 |
+
$this->assertEquals(
|
52 |
+
$sg->client->getHost(),
|
53 |
+
'https://api.sendgrid.com',
|
54 |
+
'/v3'
|
55 |
+
);
|
56 |
+
$this->assertEquals(
|
57 |
+
$sg->client->getHeaders(),
|
58 |
+
$headers
|
59 |
+
);
|
60 |
+
$this->assertEquals($sg->client->getVersion(), '/v3');
|
61 |
+
|
62 |
+
$sg2 = new \SendGrid(self::$apiKey, ['host' => 'https://api.test.com']);
|
63 |
+
$this->assertEquals($sg2->client->getHost(), 'https://api.test.com');
|
64 |
+
|
65 |
+
$sg3 = new \SendGrid(self::$apiKey, ['curl' => ['foo' => 'bar']]);
|
66 |
+
$this->assertEquals(['foo' => 'bar'], $sg3->client->getCurlOptions());
|
67 |
+
|
68 |
+
$sg4 = new \SendGrid(
|
69 |
+
self::$apiKey,
|
70 |
+
['curl' => [CURLOPT_PROXY => '127.0.0.1:8000']]
|
71 |
+
);
|
72 |
+
$this->assertEquals(
|
73 |
+
$sg4->client->getCurlOptions(),
|
74 |
+
[10004 => '127.0.0.1:8000']
|
75 |
+
);
|
76 |
+
|
77 |
+
$subuser = 'abcxyz@this.is.a.test.subuser';
|
78 |
+
$headers[] = 'On-Behalf-Of: ' . $subuser;
|
79 |
+
$sg5 = new \SendGrid(
|
80 |
+
self::$apiKey,
|
81 |
+
['impersonateSubuser' => $subuser]
|
82 |
+
);
|
83 |
+
$this->assertSame(
|
84 |
+
$headers,
|
85 |
+
$sg5->client->getHeaders()
|
86 |
+
);
|
87 |
+
}
|
88 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SingleEmailToASingleRecipientTest.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the request object generation for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* This class tests the request object generation for a /mail/send API call
|
19 |
+
*
|
20 |
+
* @package SendGrid\Tests
|
21 |
+
*/
|
22 |
+
class SingleEmailToASingleRecipientTest extends BaseTestClass
|
23 |
+
{
|
24 |
+
|
25 |
+
private $REQUEST_OBJECT = <<<'JSON'
|
26 |
+
{
|
27 |
+
"personalizations": [
|
28 |
+
{
|
29 |
+
"to": [
|
30 |
+
{
|
31 |
+
"email": "test@example.com",
|
32 |
+
"name": "Example User"
|
33 |
+
}
|
34 |
+
]
|
35 |
+
}
|
36 |
+
],
|
37 |
+
"subject": "Sending with Twilio SendGrid is Fun",
|
38 |
+
"from": {
|
39 |
+
"email": "test@example.com",
|
40 |
+
"name": "Example User"
|
41 |
+
},
|
42 |
+
"content": [
|
43 |
+
{
|
44 |
+
"type": "text/plain",
|
45 |
+
"value": "and easy to do anywhere, even with PHP"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"type": "text/html",
|
49 |
+
"value": "<strong>and easy to do anywhere, even with PHP</strong>"
|
50 |
+
}
|
51 |
+
]
|
52 |
+
}
|
53 |
+
JSON;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Test all parameters using objects
|
57 |
+
*/
|
58 |
+
public function testWithObjects()
|
59 |
+
{
|
60 |
+
$from = new \SendGrid\Mail\From("test@example.com", "Example User");
|
61 |
+
$subject = new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun");
|
62 |
+
$to = new \SendGrid\Mail\To("test@example.com", "Example User");
|
63 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
64 |
+
"and easy to do anywhere, even with PHP"
|
65 |
+
);
|
66 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
67 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
68 |
+
);
|
69 |
+
$email = new \SendGrid\Mail\Mail(
|
70 |
+
$from,
|
71 |
+
$to,
|
72 |
+
$subject,
|
73 |
+
$plainTextContent,
|
74 |
+
$htmlContent
|
75 |
+
);
|
76 |
+
$json = json_encode($email->jsonSerialize());
|
77 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
78 |
+
$this->assertTrue($isEqual);
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Test all parameters without using objects
|
83 |
+
*/
|
84 |
+
public function testWithoutObjects()
|
85 |
+
{
|
86 |
+
$email = new \SendGrid\Mail\Mail();
|
87 |
+
$email->setFrom("test@example.com", "Example User");
|
88 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun");
|
89 |
+
$email->addTo("test@example.com", "Example User");
|
90 |
+
$email->addContent("text/plain", "and easy to do anywhere, even with PHP");
|
91 |
+
$email->addContent(
|
92 |
+
"text/html", "<strong>and easy to do anywhere, even with PHP</strong>"
|
93 |
+
);
|
94 |
+
$json = json_encode($email->jsonSerialize());
|
95 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
96 |
+
$this->assertTrue($isEqual);
|
97 |
+
}
|
98 |
+
}
|
Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/test/unit/SingleEmailToMultipleRecipientsTest.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file tests the request object generation for a /mail/send API call
|
4 |
+
*
|
5 |
+
* PHP Version - 5.6, 7.0, 7.1, 7.2
|
6 |
+
*
|
7 |
+
* @package SendGrid\Tests
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2018-19 Twilio SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace SendGrid\Tests;
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class tests the request object generation for a /mail/send API call
|
20 |
+
*
|
21 |
+
* @package SendGrid\Tests
|
22 |
+
*/
|
23 |
+
class SingleEmailToMulipleRecipientsTest extends BaseTestClass
|
24 |
+
{
|
25 |
+
|
26 |
+
private $REQUEST_OBJECT = <<<'JSON'
|
27 |
+
{
|
28 |
+
"personalizations": [
|
29 |
+
{
|
30 |
+
"to": [
|
31 |
+
{
|
32 |
+
"email": "test+test1@example.com",
|
33 |
+
"name": "Example User1"
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"email": "test+test2@example.com",
|
37 |
+
"name": "Example User2"
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"email": "test+test3@example.com",
|
41 |
+
"name": "Example User3"
|
42 |
+
}
|
43 |
+
]
|
44 |
+
}
|
45 |
+
],
|
46 |
+
"subject": "Sending with Twilio SendGrid is Fun",
|
47 |
+
"content": [
|
48 |
+
{
|
49 |
+
"type": "text/plain",
|
50 |
+
"value": "and easy to do anywhere, even with PHP"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"type": "text/html",
|
54 |
+
"value": "<strong>and easy to do anywhere, even with PHP</strong>"
|
55 |
+
}
|
56 |
+
],
|
57 |
+
"from": {
|
58 |
+
"email": "test@example.com",
|
59 |
+
"name": "Example User"
|
60 |
+
}
|
61 |
+
}
|
62 |
+
JSON;
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Test when we are using objects
|
67 |
+
*/
|
68 |
+
public function testWithObjects()
|
69 |
+
{
|
70 |
+
$from = new \SendGrid\Mail\From("test@example.com", "Example User");
|
71 |
+
$tos = [
|
72 |
+
new \SendGrid\Mail\To("test+test1@example.com", "Example User1"),
|
73 |
+
new \SendGrid\Mail\To("test+test2@example.com", "Example User2"),
|
74 |
+
new \SendGrid\Mail\To("test+test3@example.com", "Example User3")
|
75 |
+
];
|
76 |
+
$subject = new \SendGrid\Mail\Subject("Sending with Twilio SendGrid is Fun");
|
77 |
+
$plainTextContent = new \SendGrid\Mail\PlainTextContent(
|
78 |
+
"and easy to do anywhere, even with PHP"
|
79 |
+
);
|
80 |
+
$htmlContent = new \SendGrid\Mail\HtmlContent(
|
81 |
+
"<strong>and easy to do anywhere, even with PHP</strong>"
|
82 |
+
);
|
83 |
+
$email = new \SendGrid\Mail\Mail(
|
84 |
+
$from,
|
85 |
+
$tos,
|
86 |
+
$subject,
|
87 |
+
$plainTextContent,
|
88 |
+
$htmlContent
|
89 |
+
);
|
90 |
+
$json = json_encode($email->jsonSerialize());
|
91 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
92 |
+
$this->assertTrue($isEqual);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Test when we are not using objects
|
97 |
+
*/
|
98 |
+
public function testWithoutObjects()
|
99 |
+
{
|
100 |
+
$email = new \SendGrid\Mail\Mail();
|
101 |
+
$email->setFrom("test@example.com", "Example User");
|
102 |
+
$tos = [
|
103 |
+
"test+test1@example.com" => "Example User1",
|
104 |
+
"test+test2@example.com" => "Example User2",
|
105 |
+
"test+test3@example.com" => "Example User3"
|
106 |
+
];
|
107 |
+
$email->addTos($tos);
|
108 |
+
$email->setSubject("Sending with Twilio SendGrid is Fun");
|
109 |
+
$email->addContent("text/plain", "and easy to do anywhere, even with PHP");
|
110 |
+
$email->addContent(
|
111 |
+
"text/html", "<strong>and easy to do anywhere, even with PHP</strong>"
|
112 |
+
);
|
113 |
+
$json = json_encode($email->jsonSerialize());
|
114 |
+
$isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT);
|
115 |
+
$this->assertTrue($isEqual);
|
116 |
+
}
|
117 |
+
}
|
Postman/Postman.php
CHANGED
@@ -91,7 +91,7 @@ class Postman {
|
|
91 |
}
|
92 |
|
93 |
if ( isset( $_REQUEST ['page'] ) && $this->logger->isTrace() ) {
|
94 |
-
$this->logger->trace( 'Current page: ' . $_REQUEST ['page'] );
|
95 |
}
|
96 |
|
97 |
// register the email transports
|
@@ -369,9 +369,9 @@ class Postman {
|
|
369 |
<?php _e('Post SMTP v2 includes and new feature called: <b>Mailer Type</b>.', 'post-smtp' ); ?><br>
|
370 |
<?php _e('I highly recommend to change and <strong>TEST</strong> Post SMTP with the value <code>PHPMailer</code>.', 'post-smtp' ); ?><br>
|
371 |
<?php _e('if it will not work properly you can change back to the default value: <code>PostSMTP</code>.', 'post-smtp' ); ?><br>
|
372 |
-
<a target="_blank" href="<?php echo
|
373 |
<figure>
|
374 |
-
<img width="180" src="<?php echo
|
375 |
<figcaption><?php _e('click to enlarge image.', 'post-smtp' ); ?></figcaption>
|
376 |
</figure>
|
377 |
</a>
|
91 |
}
|
92 |
|
93 |
if ( isset( $_REQUEST ['page'] ) && $this->logger->isTrace() ) {
|
94 |
+
$this->logger->trace( 'Current page: ' . sanitize_text_field($_REQUEST ['page']) );
|
95 |
}
|
96 |
|
97 |
// register the email transports
|
369 |
<?php _e('Post SMTP v2 includes and new feature called: <b>Mailer Type</b>.', 'post-smtp' ); ?><br>
|
370 |
<?php _e('I highly recommend to change and <strong>TEST</strong> Post SMTP with the value <code>PHPMailer</code>.', 'post-smtp' ); ?><br>
|
371 |
<?php _e('if it will not work properly you can change back to the default value: <code>PostSMTP</code>.', 'post-smtp' ); ?><br>
|
372 |
+
<a target="_blank" href="<?php echo POST_SMTP_URL; ?>/style/images/mailer-type.gif">
|
373 |
<figure>
|
374 |
+
<img width="180" src="<?php echo POST_SMTP_URL; ?>/style/images/mailer-type.gif" alt="how to set mailer type">
|
375 |
<figcaption><?php _e('click to enlarge image.', 'post-smtp' ); ?></figcaption>
|
376 |
</figure>
|
377 |
</a>
|
Postman/PostmanAdminController.php
CHANGED
@@ -128,11 +128,13 @@ if ( ! class_exists( 'PostmanAdminController' ) ) {
|
|
128 |
$this->logger->debug( 'Looking for grant code' );
|
129 |
if ( isset( $_GET ['code'] ) ) {
|
130 |
$this->logger->debug( 'Found authorization grant code' );
|
|
|
131 |
// queue the function that processes the incoming grant code
|
132 |
$this->registerInitFunction( 'handleAuthorizationGrant' );
|
133 |
return;
|
134 |
}
|
135 |
}
|
|
|
136 |
|
137 |
// continue to initialize the AdminController
|
138 |
add_action( 'init', array(
|
@@ -328,7 +330,7 @@ if ( ! class_exists( 'PostmanAdminController' ) ) {
|
|
328 |
$this->logger->debug( 'is wpnonce import-settings?' );
|
329 |
$success = true;
|
330 |
if ( wp_verify_nonce( $_REQUEST ['_wpnonce'], PostmanAdminController::IMPORT_SETTINGS_SLUG ) ) {
|
331 |
-
$success = PostmanOptions::getInstance()->import( $_POST ['settings'] );
|
332 |
} else {
|
333 |
$success = false;
|
334 |
}
|
128 |
$this->logger->debug( 'Looking for grant code' );
|
129 |
if ( isset( $_GET ['code'] ) ) {
|
130 |
$this->logger->debug( 'Found authorization grant code' );
|
131 |
+
|
132 |
// queue the function that processes the incoming grant code
|
133 |
$this->registerInitFunction( 'handleAuthorizationGrant' );
|
134 |
return;
|
135 |
}
|
136 |
}
|
137 |
+
do_action('post_smtp_handle_oauth', $this->messageHandler );
|
138 |
|
139 |
// continue to initialize the AdminController
|
140 |
add_action( 'init', array(
|
330 |
$this->logger->debug( 'is wpnonce import-settings?' );
|
331 |
$success = true;
|
332 |
if ( wp_verify_nonce( $_REQUEST ['_wpnonce'], PostmanAdminController::IMPORT_SETTINGS_SLUG ) ) {
|
333 |
+
$success = PostmanOptions::getInstance()->import( sanitize_textarea_field($_POST ['settings']) );
|
334 |
} else {
|
335 |
$success = false;
|
336 |
}
|
Postman/PostmanAjaxController.php
CHANGED
@@ -49,9 +49,16 @@ if (! class_exists ( 'PostmanAbstractAjaxHandler' )) {
|
|
49 |
*/
|
50 |
protected function getRequestParameter($parameterName) {
|
51 |
if (isset ( $_POST [$parameterName] )) {
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$this->logger->trace ( sprintf ( 'Found parameter "%s"', $parameterName ) );
|
54 |
$this->logger->trace ( $value );
|
|
|
55 |
return $value;
|
56 |
}
|
57 |
}
|
49 |
*/
|
50 |
protected function getRequestParameter($parameterName) {
|
51 |
if (isset ( $_POST [$parameterName] )) {
|
52 |
+
if ( is_array($_POST [$parameterName] ) ) {
|
53 |
+
array_walk_recursive( $_POST [$parameterName], 'sanitize_text_field' );
|
54 |
+
$value = $_POST [$parameterName];
|
55 |
+
} else {
|
56 |
+
$value = sanitize_text_field($_POST[$parameterName]);
|
57 |
+
}
|
58 |
+
|
59 |
$this->logger->trace ( sprintf ( 'Found parameter "%s"', $parameterName ) );
|
60 |
$this->logger->trace ( $value );
|
61 |
+
|
62 |
return $value;
|
63 |
}
|
64 |
}
|
Postman/PostmanInputSanitizer.php
CHANGED
@@ -121,7 +121,7 @@ if ( ! class_exists( 'PostmanInputSanitizer' ) ) {
|
|
121 |
public function sanitizeString( $desc, $key, $input, &$new_input ) {
|
122 |
if ( isset( $input [ $key ] ) ) {
|
123 |
$this->logSanitize( $desc, $input [ $key ] );
|
124 |
-
$new_input [ $key ] = trim( $input [ $key ] );
|
125 |
}
|
126 |
}
|
127 |
|
@@ -149,7 +149,7 @@ if ( ! class_exists( 'PostmanInputSanitizer' ) ) {
|
|
149 |
$new_input [ $key ] = $existingPassword;
|
150 |
} else {
|
151 |
// otherwise the password is new, so trim it
|
152 |
-
$new_input [ $key ] = trim( $input [ $key ] );
|
153 |
}
|
154 |
// log it
|
155 |
$this->logSanitize( $desc, $new_input [ $key ] );
|
@@ -158,6 +158,7 @@ if ( ! class_exists( 'PostmanInputSanitizer' ) ) {
|
|
158 |
}
|
159 |
$this->logger->debug( sprintf( 'Encoding %s as %s', $desc, $new_input [ $key ] ) );
|
160 |
}
|
|
|
161 |
private function sanitizeLogMax( $desc, $key, $input, &$new_input ) {
|
162 |
if ( isset( $input [ $key ] ) ) {
|
163 |
$value = absint( $input [ $key ] );
|
@@ -167,10 +168,11 @@ if ( ! class_exists( 'PostmanInputSanitizer' ) ) {
|
|
167 |
$h->addError( sprintf( '%s %s', __( 'Maximum Log Entries', 'post-smtp' ), __( 'must be greater than 0', 'post-smtp' ) ) );
|
168 |
} else {
|
169 |
$this->logSanitize( $desc, $input [ $key ] );
|
170 |
-
$new_input [ $key ] = $value;
|
171 |
}
|
172 |
}
|
173 |
}
|
|
|
174 |
private function sanitizeInt( $desc, $key, $input, &$new_input ) {
|
175 |
if ( isset( $input [ $key ] ) ) {
|
176 |
$this->logSanitize( $desc, $input [ $key ] );
|
121 |
public function sanitizeString( $desc, $key, $input, &$new_input ) {
|
122 |
if ( isset( $input [ $key ] ) ) {
|
123 |
$this->logSanitize( $desc, $input [ $key ] );
|
124 |
+
$new_input [ $key ] = sanitize_text_field( trim( $input [ $key ] ) );
|
125 |
}
|
126 |
}
|
127 |
|
149 |
$new_input [ $key ] = $existingPassword;
|
150 |
} else {
|
151 |
// otherwise the password is new, so trim it
|
152 |
+
$new_input [ $key ] = sanitize_text_field( trim( $input [ $key ] ) );
|
153 |
}
|
154 |
// log it
|
155 |
$this->logSanitize( $desc, $new_input [ $key ] );
|
158 |
}
|
159 |
$this->logger->debug( sprintf( 'Encoding %s as %s', $desc, $new_input [ $key ] ) );
|
160 |
}
|
161 |
+
|
162 |
private function sanitizeLogMax( $desc, $key, $input, &$new_input ) {
|
163 |
if ( isset( $input [ $key ] ) ) {
|
164 |
$value = absint( $input [ $key ] );
|
168 |
$h->addError( sprintf( '%s %s', __( 'Maximum Log Entries', 'post-smtp' ), __( 'must be greater than 0', 'post-smtp' ) ) );
|
169 |
} else {
|
170 |
$this->logSanitize( $desc, $input [ $key ] );
|
171 |
+
$new_input [ $key ] = absint($value);
|
172 |
}
|
173 |
}
|
174 |
}
|
175 |
+
|
176 |
private function sanitizeInt( $desc, $key, $input, &$new_input ) {
|
177 |
if ( isset( $input [ $key ] ) ) {
|
178 |
$this->logSanitize( $desc, $input [ $key ] );
|
Postman/PostmanLogFields.php
CHANGED
@@ -3,17 +3,17 @@ class PostmanLogFields {
|
|
3 |
|
4 |
private $fields = array(
|
5 |
'success' => 'sanitize_text_field',
|
6 |
-
'from_header' => '
|
7 |
-
'to_header' => '
|
8 |
-
'cc_header' => '
|
9 |
-
'bcc_header' => '
|
10 |
-
'reply_to_header' => '
|
11 |
'transport_uri' => 'sanitize_text_field',
|
12 |
'original_to' => 'sanitize_text_field',
|
13 |
'original_subject' => 'sanitize_text_field',
|
14 |
-
'original_message' =>
|
15 |
-
'original_headers' => '
|
16 |
-
'session_transcript' => '
|
17 |
);
|
18 |
|
19 |
private static $instance = null;
|
@@ -28,7 +28,7 @@ class PostmanLogFields {
|
|
28 |
|
29 |
private function __construct()
|
30 |
{
|
31 |
-
|
32 |
}
|
33 |
|
34 |
public function get( $post_id ) {
|
@@ -41,6 +41,10 @@ class PostmanLogFields {
|
|
41 |
return $data;
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
44 |
public function update( $post_id, $key, $value ) {
|
45 |
$sanitized = $this->sanitize( $key, $value );
|
46 |
$encode = $this->encode( $sanitized );
|
@@ -49,6 +53,11 @@ class PostmanLogFields {
|
|
49 |
}
|
50 |
|
51 |
private function maybe_json( $json ) {
|
|
|
|
|
|
|
|
|
|
|
52 |
if ( $this->isJson( $json ) ) {
|
53 |
return implode( ',', json_decode( $json, true ) );
|
54 |
}
|
@@ -64,9 +73,14 @@ class PostmanLogFields {
|
|
64 |
}
|
65 |
|
66 |
private function sanitize( $key, $value ) {
|
|
|
67 |
$callback = is_array( $value ) ? 'array_map' : 'call_user_func';
|
68 |
|
69 |
-
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
private function sanitize_message( $message ) {
|
@@ -83,4 +97,43 @@ class PostmanLogFields {
|
|
83 |
|
84 |
return $value;
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
|
3 |
|
4 |
private $fields = array(
|
5 |
'success' => 'sanitize_text_field',
|
6 |
+
'from_header' => [ 'PostmanLogFields', 'email_header_sanitize' ],
|
7 |
+
'to_header' => [ 'PostmanLogFields', 'email_header_sanitize' ],
|
8 |
+
'cc_header' => [ 'PostmanLogFields', 'email_header_sanitize' ],
|
9 |
+
'bcc_header' => [ 'PostmanLogFields', 'email_header_sanitize' ],
|
10 |
+
'reply_to_header' => [ 'PostmanLogFields', 'email_header_sanitize' ],
|
11 |
'transport_uri' => 'sanitize_text_field',
|
12 |
'original_to' => 'sanitize_text_field',
|
13 |
'original_subject' => 'sanitize_text_field',
|
14 |
+
'original_message' => '', // only sent to viewed
|
15 |
+
'original_headers' => '', // only sent to viewed
|
16 |
+
'session_transcript' => '', // escaped when viewed
|
17 |
);
|
18 |
|
19 |
private static $instance = null;
|
28 |
|
29 |
private function __construct()
|
30 |
{
|
31 |
+
|
32 |
}
|
33 |
|
34 |
public function get( $post_id ) {
|
41 |
return $data;
|
42 |
}
|
43 |
|
44 |
+
public function get_fields() {
|
45 |
+
return $this->fields;
|
46 |
+
}
|
47 |
+
|
48 |
public function update( $post_id, $key, $value ) {
|
49 |
$sanitized = $this->sanitize( $key, $value );
|
50 |
$encode = $this->encode( $sanitized );
|
53 |
}
|
54 |
|
55 |
private function maybe_json( $json ) {
|
56 |
+
|
57 |
+
if ( is_array( $json ) ) {
|
58 |
+
return implode( ',', $json );
|
59 |
+
}
|
60 |
+
|
61 |
if ( $this->isJson( $json ) ) {
|
62 |
return implode( ',', json_decode( $json, true ) );
|
63 |
}
|
73 |
}
|
74 |
|
75 |
private function sanitize( $key, $value ) {
|
76 |
+
|
77 |
$callback = is_array( $value ) ? 'array_map' : 'call_user_func';
|
78 |
|
79 |
+
if ( ! empty( $this->fields[$key] ) ) {
|
80 |
+
return $callback( $this->fields[$key], $value );
|
81 |
+
}
|
82 |
+
|
83 |
+
return $value;
|
84 |
}
|
85 |
|
86 |
private function sanitize_message( $message ) {
|
97 |
|
98 |
return $value;
|
99 |
}
|
100 |
+
|
101 |
+
public function get_string_between($string, $start, $end){
|
102 |
+
$string = ' ' . $string;
|
103 |
+
$ini = strpos($string, $start);
|
104 |
+
|
105 |
+
if ($ini == 0) {
|
106 |
+
return '';
|
107 |
+
}
|
108 |
+
|
109 |
+
$ini += strlen($start);
|
110 |
+
$len = strpos($string, $end, $ini) - $ini;
|
111 |
+
|
112 |
+
return substr($string, $ini, $len);
|
113 |
+
}
|
114 |
+
|
115 |
+
public function email_header_sanitize($value) {
|
116 |
+
|
117 |
+
$parts = explode( ',', $value );
|
118 |
+
|
119 |
+
$sanitized = [];
|
120 |
+
foreach ( $parts as $part ) {
|
121 |
+
|
122 |
+
if ( strpos( $part, '<' ) !== false ) {
|
123 |
+
$email = $this->get_string_between( $part, '<', '>' );
|
124 |
+
$clean_email = $this->sanitize_email($email);
|
125 |
+
preg_match('/(.*)</', $part, $output_array);
|
126 |
+
$name = filter_var( trim( $output_array[1] ), FILTER_SANITIZE_STRING );
|
127 |
+
|
128 |
+
$sanitized[] = "{$name} <{$clean_email}>";
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
return ! empty( $sanitized ) ? implode( ',', $sanitized ) : implode( ',', array_map( [ $this, 'sanitize_email'], $parts ) );
|
133 |
+
}
|
134 |
+
|
135 |
+
public function sanitize_email( $email ) {
|
136 |
+
return filter_var( $email, FILTER_SANITIZE_EMAIL );
|
137 |
+
}
|
138 |
}
|
139 |
+
|
Postman/PostmanPluginFeedback.php
CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
4 |
}
|
5 |
class PostmanPluginFeedback {
|
6 |
function __construct() {
|
7 |
-
add_filter( 'plugin_action_links_' . plugin_basename(
|
8 |
add_action( 'wp_ajax_post_user_feedback', array( $this, 'post_user_feedback' ) );
|
9 |
global $pagenow;
|
10 |
if ( 'plugins.php' === $pagenow ) {
|
@@ -16,7 +16,7 @@ class PostmanPluginFeedback {
|
|
16 |
|
17 |
function load_scripts() {
|
18 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
19 |
-
wp_register_script( 'post-feedback', plugins_url( 'script/feedback/feedback.js',
|
20 |
wp_localize_script( 'post-feedback', 'post_feedback', array( 'admin_ajax' => admin_url( 'admin-ajax.php' ) ) );
|
21 |
wp_enqueue_script( 'post-feedback' );
|
22 |
}
|
4 |
}
|
5 |
class PostmanPluginFeedback {
|
6 |
function __construct() {
|
7 |
+
add_filter( 'plugin_action_links_' . plugin_basename( POST_SMTP_BASE ), array( $this, 'insert_deactivate_link_id' ) );
|
8 |
add_action( 'wp_ajax_post_user_feedback', array( $this, 'post_user_feedback' ) );
|
9 |
global $pagenow;
|
10 |
if ( 'plugins.php' === $pagenow ) {
|
16 |
|
17 |
function load_scripts() {
|
18 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
19 |
+
wp_register_script( 'post-feedback', plugins_url( 'script/feedback/feedback.js', POST_SMTP_BASE ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-dialog' ), false, true );
|
20 |
wp_localize_script( 'post-feedback', 'post_feedback', array( 'admin_ajax' => admin_url( 'admin-ajax.php' ) ) );
|
21 |
wp_enqueue_script( 'post-feedback' );
|
22 |
}
|
Postman/PostmanViewController.php
CHANGED
@@ -319,11 +319,11 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
|
|
319 |
$show = get_option('postman_release_version' );
|
320 |
printf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) );
|
321 |
|
322 |
-
if ( ! $show ) {
|
323 |
echo '
|
324 |
<div class="updated settings-error notice is-dismissible">
|
325 |
<p>
|
326 |
-
<strong>Version ' . $version . '
|
327 |
</p>
|
328 |
<button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
|
329 |
<span class="screen-reader-text">Dismiss this notice.</span>
|
@@ -331,7 +331,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
|
|
331 |
</div>';
|
332 |
}
|
333 |
|
334 |
-
include_once
|
335 |
|
336 |
echo '<div class="twitter-wrap">';
|
337 |
print '<div id="postman-main-menu" class="welcome-panel">';
|
@@ -347,7 +347,11 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
|
|
347 |
print '<ul>';
|
348 |
|
349 |
// Grant permission with Google
|
|
|
350 |
PostmanTransportRegistry::getInstance()->getSelectedTransport()->printActionMenuItem();
|
|
|
|
|
|
|
351 |
|
352 |
if ( PostmanWpMailBinder::getInstance()->isBound() ) {
|
353 |
printf( '<li><a href="%s" class="welcome-icon send_test_email">%s</a></li>', $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ), __( 'Send a Test Email', 'post-smtp' ) );
|
@@ -374,7 +378,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
|
|
374 |
printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanConnectivityTestController::PORT_TEST_SLUG ), __( 'Connectivity Test', 'post-smtp' ) );
|
375 |
printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanDiagnosticTestController::DIAGNOSTICS_SLUG ), __( 'Diagnostic Test', 'post-smtp' ) );
|
376 |
printf( '<li><a href="%s" data-security="%s" class="welcome-icon release-lock-file">%s</a></li>', '#', wp_create_nonce( "postman" ), __( 'Release Lock File Error', 'post-smtp' ) );
|
377 |
-
printf( '<li><a href="https://
|
378 |
printf( '<li><img class="align-middle" src="' . plugins_url( 'style/images/new.gif', dirname( __DIR__ ) . '/postman-smtp.php' ) . '"><a target="blank" class="align-middle" href="https://postmansmtp.com/category/guides/" class="welcome-icon postman_guides">%s</a></li>', __( 'Guides', 'post-smtp' ) );
|
379 |
print '</ul></div></div></div></div>';
|
380 |
?>
|
319 |
$show = get_option('postman_release_version' );
|
320 |
printf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) );
|
321 |
|
322 |
+
if ( ! $show && POST_SMTP_SHOW_RELEASE_MESSAGE ) {
|
323 |
echo '
|
324 |
<div class="updated settings-error notice is-dismissible">
|
325 |
<p>
|
326 |
+
<strong>Version ' . $version . ' ' . POST_SMTP_RELEASE_MESSAGE . ':</strong> <a target="_blank" href="' . POST_SMTP_RELEASE_URL . '">Read Here</a>
|
327 |
</p>
|
328 |
<button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
|
329 |
<span class="screen-reader-text">Dismiss this notice.</span>
|
331 |
</div>';
|
332 |
}
|
333 |
|
334 |
+
include_once POST_SMTP_PATH . '/Postman/extra/donation.php';
|
335 |
|
336 |
echo '<div class="twitter-wrap">';
|
337 |
print '<div id="postman-main-menu" class="welcome-panel">';
|
347 |
print '<ul>';
|
348 |
|
349 |
// Grant permission with Google
|
350 |
+
ob_start();
|
351 |
PostmanTransportRegistry::getInstance()->getSelectedTransport()->printActionMenuItem();
|
352 |
+
$oauth_link = ob_get_clean();
|
353 |
+
|
354 |
+
echo apply_filters( 'post_smtp_oauth_actions', $oauth_link );
|
355 |
|
356 |
if ( PostmanWpMailBinder::getInstance()->isBound() ) {
|
357 |
printf( '<li><a href="%s" class="welcome-icon send_test_email">%s</a></li>', $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ), __( 'Send a Test Email', 'post-smtp' ) );
|
378 |
printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanConnectivityTestController::PORT_TEST_SLUG ), __( 'Connectivity Test', 'post-smtp' ) );
|
379 |
printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanDiagnosticTestController::DIAGNOSTICS_SLUG ), __( 'Diagnostic Test', 'post-smtp' ) );
|
380 |
printf( '<li><a href="%s" data-security="%s" class="welcome-icon release-lock-file">%s</a></li>', '#', wp_create_nonce( "postman" ), __( 'Release Lock File Error', 'post-smtp' ) );
|
381 |
+
printf( '<li><a href="https://wordpress.org/support/plugin/post-smtp/" class="welcome-icon postman_support">%s</a></li>', __( 'Online Support', 'post-smtp' ) );
|
382 |
printf( '<li><img class="align-middle" src="' . plugins_url( 'style/images/new.gif', dirname( __DIR__ ) . '/postman-smtp.php' ) . '"><a target="blank" class="align-middle" href="https://postmansmtp.com/category/guides/" class="welcome-icon postman_guides">%s</a></li>', __( 'Guides', 'post-smtp' ) );
|
383 |
print '</ul></div></div></div></div>';
|
384 |
?>
|
Postman/PostmanWpMail.php
CHANGED
@@ -82,7 +82,8 @@ if ( ! class_exists( 'PostmanWpMail' ) ) {
|
|
82 |
$hostName = php_uname('n');
|
83 |
}
|
84 |
|
85 |
-
return $id . '@' . $hostName;
|
|
|
86 |
}
|
87 |
|
88 |
/**
|
82 |
$hostName = php_uname('n');
|
83 |
}
|
84 |
|
85 |
+
return $id . '@' . str_replace('www.', '', $hostName);
|
86 |
+
|
87 |
}
|
88 |
|
89 |
/**
|
postman-smtp.php
CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
6 |
* Plugin Name: Post SMTP
|
7 |
* Plugin URI: https://wordpress.org/plugins/post-smtp/
|
8 |
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
|
9 |
-
* Version: 2.0.
|
10 |
* Author: Yehuda Hassine
|
11 |
* Text Domain: post-smtp
|
12 |
* Author URI: https://postmansmtp.com
|
@@ -41,10 +41,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
41 |
* DO some check and Start Postman
|
42 |
*/
|
43 |
|
44 |
-
define( '
|
45 |
-
define( '
|
46 |
-
define( '
|
47 |
-
define( 'POST_SMTP_VER', '2.0.
|
|
|
|
|
|
|
48 |
|
49 |
$postman_smtp_exist = in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) );
|
50 |
$required_php_version = version_compare( PHP_VERSION, '5.6.0', '<' );
|
@@ -60,7 +63,7 @@ if ( $postman_smtp_exist || $required_php_version ) {
|
|
60 |
add_action( 'admin_notices', 'post_smtp_plugin_admin_notice_version' );
|
61 |
}
|
62 |
} else {
|
63 |
-
|
64 |
}
|
65 |
|
66 |
|
@@ -116,12 +119,17 @@ function post_dismiss_not_configured() {
|
|
116 |
}
|
117 |
add_action( 'admin_footer', 'post_dismiss_not_configured' );
|
118 |
|
|
|
|
|
|
|
|
|
|
|
119 |
/**
|
120 |
* Create the main Postman class to start Postman
|
121 |
*
|
122 |
* @param mixed $startingMemory
|
123 |
*/
|
124 |
-
function
|
125 |
post_setupPostman();
|
126 |
PostmanUtils::logMemoryUse( $startingMemory, 'Postman' );
|
127 |
}
|
6 |
* Plugin Name: Post SMTP
|
7 |
* Plugin URI: https://wordpress.org/plugins/post-smtp/
|
8 |
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
|
9 |
+
* Version: 2.0.5
|
10 |
* Author: Yehuda Hassine
|
11 |
* Text Domain: post-smtp
|
12 |
* Author URI: https://postmansmtp.com
|
41 |
* DO some check and Start Postman
|
42 |
*/
|
43 |
|
44 |
+
define( 'POST_SMTP_BASE', __FILE__ );
|
45 |
+
define( 'POST_SMTP_PATH', __DIR__ );
|
46 |
+
define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
|
47 |
+
define( 'POST_SMTP_VER', '2.0.5' );
|
48 |
+
define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', false );
|
49 |
+
define( 'POST_SMTP_RELEASE_MESSAGE', false );
|
50 |
+
define( 'POST_SMTP_RELEASE_URL', '#' );
|
51 |
|
52 |
$postman_smtp_exist = in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) );
|
53 |
$required_php_version = version_compare( PHP_VERSION, '5.6.0', '<' );
|
63 |
add_action( 'admin_notices', 'post_smtp_plugin_admin_notice_version' );
|
64 |
}
|
65 |
} else {
|
66 |
+
post_smtp_start( memory_get_usage() );
|
67 |
}
|
68 |
|
69 |
|
119 |
}
|
120 |
add_action( 'admin_footer', 'post_dismiss_not_configured' );
|
121 |
|
122 |
+
function post_smtp_general_scripts() {
|
123 |
+
wp_enqueue_script( 'post-smtp-hooks', POST_SMTP_URL . '/script/post-smtp-hooks.js', [], false );
|
124 |
+
}
|
125 |
+
add_action( 'admin_enqueue_scripts', 'post_smtp_general_scripts', 8 );
|
126 |
+
|
127 |
/**
|
128 |
* Create the main Postman class to start Postman
|
129 |
*
|
130 |
* @param mixed $startingMemory
|
131 |
*/
|
132 |
+
function post_smtp_start( $startingMemory ) {
|
133 |
post_setupPostman();
|
134 |
PostmanUtils::logMemoryUse( $startingMemory, 'Postman' );
|
135 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m
|
|
4 |
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 5.2.2
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -12,8 +12,7 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
= Version 2.0.
|
16 |
-
Final fixes to make it the best and secure mailer plugin for WordPress
|
17 |
|
18 |
= The Only SMTP plugin with chrome Notifications =
|
19 |
Get notified if your emails are failing inside your Chrome browser. [Download here](https://chrome.google.com/webstore/detail/post-smtp-notifications/npklmbkpbknkmbohdbpikeidiaekjoch?hl=en-US)
|
@@ -289,6 +288,10 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
|
|
289 |
|
290 |
== Changelog ==
|
291 |
|
|
|
|
|
|
|
|
|
292 |
= 2.0.4 - 2019-08-27
|
293 |
* Updated: More security.
|
294 |
|
4 |
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 5.2.2
|
7 |
+
Stable tag: 2.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
= Version 2.0.5 released - Few notifications errors, export logs and minor improvements =
|
|
|
16 |
|
17 |
= The Only SMTP plugin with chrome Notifications =
|
18 |
Get notified if your emails are failing inside your Chrome browser. [Download here](https://chrome.google.com/webstore/detail/post-smtp-notifications/npklmbkpbknkmbohdbpikeidiaekjoch?hl=en-US)
|
288 |
|
289 |
== Changelog ==
|
290 |
|
291 |
+
= 2.0.5 - 2019-09-26
|
292 |
+
* New: You can now export logs to CSV.
|
293 |
+
* Updated: Few notifications errors, and minor improvements.
|
294 |
+
|
295 |
= 2.0.4 - 2019-08-27
|
296 |
* Updated: More security.
|
297 |
|
style/postman-email-log.css
CHANGED
@@ -18,15 +18,16 @@ th#date {
|
|
18 |
.postman-log-row {
|
19 |
padding: 20px;
|
20 |
display: flex;
|
21 |
-
justify-content: space-around;
|
22 |
align-items: center;
|
23 |
-
border-bottom: 1px solid #ddd;
|
|
|
24 |
}
|
25 |
|
26 |
#postman_page_records {
|
27 |
padding: 10px;
|
28 |
line-height: normal;
|
29 |
height: auto;
|
|
|
30 |
}
|
31 |
|
32 |
#postman-log-actions {
|
18 |
.postman-log-row {
|
19 |
padding: 20px;
|
20 |
display: flex;
|
|
|
21 |
align-items: center;
|
22 |
+
border-bottom: 1px solid #ddd;
|
23 |
+
flex-wrap: wrap;
|
24 |
}
|
25 |
|
26 |
#postman_page_records {
|
27 |
padding: 10px;
|
28 |
line-height: normal;
|
29 |
height: auto;
|
30 |
+
margin-right: 10px;
|
31 |
}
|
32 |
|
33 |
#postman-log-actions {
|