1. Go to this page and download the library: Download godpod/sendgrid 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/ */
$email = new SendGrid\Email();
$email->addTo('[email protected]')->
addTo('[email protected]')->
addTo('[email protected]')->
...
setHtml('Hey %name%, we've seen that you've been gone for a while')->
addSubstitution('%name%', array('John', 'Harry', 'Bob'));
$email = new SendGrid\Email();
$email->addTos(array('[email protected]', '[email protected]', '[email protected]'))
->setSubject('%subject%')
->addSubstitution('%subject%', array('Subject to John', 'Subject to Harry', 'Subject to Bob'))
...;
$email = new SendGrid\Email();
$email->addTos(array('[email protected]', '[email protected]', '[email protected]'))
->setSubject('%subject%')
->setSubstitutions(array('%name%' => array('John', 'Harry', 'Bob') , '%subject%' => array('Subject to John', 'Subject to Harry', 'Subject to Bob')))
...;
$email = new SendGrid\Email();
$email->addTo('[email protected]')->
addTo("[email protected]")->
addTo("[email protected]")->
...
setHtml("Hey %name%, you work at %place%")->
addSubstitution("%name%", array("John", "Harry", "Bob"))->
addSubstitution("%place%", array("%office%", "%office%", "%home%"))->
addSection("%office%", "an office")->
addSection("%home%", "your house");
$email = new SendGrid\Email();
$email->addTo('[email protected]')->
addTo("[email protected]")->
addTo("[email protected]")->
...
setHtml("Hey %name%, you work at %place%")->
addSubstitution("%name%", array("John", "Harry", "Bob"))->
addSubstitution("%place%", array("%office%", "%office%", "%home%"))->
setSections(array("%office%" => "an office", "%home%" => "your house"));
$email = new SendGrid\Email();
$email->addTo('[email protected]')->
...
setUniqueArgs(array('cow' => 'chicken'));
$email = new SendGrid\Email();
$email->addTo('[email protected]')->
...
addFilter("gravatar", "enable", 1)->
addFilter("footer", "enable", 1)->
addFilter("footer", "text/plain", "Here is a plain text footer")->
addFilter("footer", "text/html", "<p style='color:red;'>Here is an HTML footer</p>");
$sendgrid = new SendGrid('username', 'password', array( 'url' => 'http://sendgrid.org:80/send'));
$sendgrid = new SendGrid(SENDGRID_USERNAME, SENDGRID_PASSWORD, array("turn_off_ssl_verification" => true));
$sendgrid = new SendGrid(SENDGRID_USERNAME, SENDGRID_PASSWORD);
$email = new SendGrid\Email();
$recipients = array("[email protected]", "[email protected]", "[email protected]");
$names = array("Alpha", "Beta", "Zeta");
$email->setFrom("[email protected]")->
setSubject('[sendgrid-php-batch-email]')->
setTos($recipients)->
addSubstitution("%name%", $names)->
setText("Hey %name, we have an email for you")->
setHtml("<h1>Hey %name%, we have an email for you</h1>");
$result = $sendgrid->send($email);
bash
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.