Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thinkingserious/8c277dc0b96e59661dcd to your computer and use it in GitHub Desktop.
Save thinkingserious/8c277dc0b96e59661dcd to your computer and use it in GitHub Desktop.
SendGrid PHP v3 ASM Suppressions POST Example
<?php
require 'vendor/autoload.php';
Dotenv::load(__DIR__);
$sendgrid_apikey = getenv('SG_KEY');
$sendgrid = new Client($sendgrid_apikey);
$group_id = 70;
$email = 'elmer.thomas+test1@gmail.com';
$response = $sendgrid->asm_suppressions->post($group_id, $email);
print("Status Code: " . $response->getStatusCode() . "\n");
print("Body: " . $response->getBody() . "\n");
$group_id = 70;
$email = array('elmer.thomas+test2@gmail.com', 'elmer.thomas+test3@gmail.com');
$response = $sendgrid->asm_suppressions->post($group_id, $email);
print("Status Code: " . $response->getStatusCode() . "\n");
print("Body: " . $response->getBody() . "\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment