1. Go to this page and download the library: Download priyolahiri/sendgrid-php 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/ */
$mail = new SendGrid\Mail();
$mail->addTo('[email protected]')->
...
addAttachment("../path/to/file.txt");
$mail = new SendGrid\Mail();
$mail->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"));
$mail = new SendGrid\Mail();
$mail->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");
$mail = new SendGrid\Mail();
$mail->addTo('[email protected]')->
...
addFilterSetting("gravatar", "enable", 1)->
addFilterSetting("footer", "enable", 1)->
addFilterSetting("footer", "text/plain", "Here is a plain text footer")->
addFilterSetting("footer", "text/html", "<p style='color:red;'>Here is an HTML footer</p>");
$mail = new SendGrid\Mail();
$mail->addTo('[email protected]')->
...
addHeader("category", "My New Category");