/home/techb158/immovalet.com/vendor/sendgrid/sendgrid/examples/helpers/contacts
Edit: /home/techb158/immovalet.com/vendor/sendgrid/sendgrid/examples/helpers/contacts/recipients.php (1920B)
'Test',
'last-name' => 'Tester',
'email' => 'test@test.com'
);
$firstName = $post_body['first-name'];
$lastName = $post_body['last-name'];
$email = $post_body['email'];
$recipient = new \SendGrid\Contacts\Recipient($firstName, $lastName, $email);
// $request_body = json_encode(array($recipient));
$request_body = json_decode(
'[
{
"email": "' . $recipient->getEmail() . '",
"first_name": "' . $recipient->getFirstName() . '",
"last_name": "' . $recipient->getLastName() . '"
}
]'
);
try {
$response = $sg->client->contactdb()->recipients()->post($request_body);
print $response->statusCode() . "\n";
print_r($response->headers());
print $response->body() . "\n";
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
buildRecipientForm(); // This will build and output an HTML form
recipientFormSubmit(); // This will simulate a form submission and will output the response.