Basic Text Email
<?php
$sendgrid = new SendGrid("YOUR_SENDGRID_API_KEY");
$email = new SendGrid\Email();
$email->addTo("[email protected]")
->setFrom("[email protected]")
->setSubject("Subject Text")
->setText("This is a sample basic text email using ");
$sendgrid->send($email);
Adding addtional recipients, CC recipients, BCC recipients
<?php
$sendgrid = new SendGrid("YOUR_SENDGRID_API_KEY");
$email = new SendGrid\Email();
$email->addTo("[email protected]")
->setFrom("[email protected]")
->setSubject("Subject Text")
->setHtml("<html><body><p><b>This paragraph is bold.</b></p><p><i>This text is italic.</i></p></body></html>");
$personalization = new Personalization();
$email = new Email("Recepient Name", "[email protected]");
$personalization->addTo($email);
$email = new Email("RecepientCC Name", "[email protected]");
$personalization->addCc($email);
$email = new Email("RecepientBCC Name", "[email protected]");
$personalization->addBcc($email);
$email->addPersonalization($personalization);
$sendgrid->send($email);