PHP code example of aslamhus / sendgrid-email-wrapper
1. Go to this page and download the library: Download aslamhus/sendgrid-email-wrapper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aslamhus / sendgrid-email-wrapper example snippets
composer
// add your api key
$email = new Email('your-sendgrid-api-key');
// make sure to add your single sender identity email and name
$didSend = $email->sendVerifyIntegrationEmail(['[email protected]', 'Verified User']);
// $didSend will return true if everything is set up correctly.
$email->addContent('text/plain', 'This is the plain text content');
$email->addContent('text/html', '<p>This is the HTML content</p>');
// retrieve the response body, headers and status code after sending
$response = $email->getResponse();
print_r($response->headers());
echo $response->statusCode()
echo $response->body()
composer run test
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.