Created
June 16, 2016 12:17
-
-
Save a-sipnevski/a203aab02c833363ecef2b07e953cb75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require("./sendgrid-php/sendgrid-php.php"); | |
$sendgrid = new SendGrid('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'); | |
$email = new SendGrid\Email(); | |
$name = $_POST['name']; | |
$emailuser = $_POST['email']; | |
$templateId = '61f8dafe-c578-480a-b5b6-894fdbd1e6f1'; | |
->addTo($emailuser) | |
->setFrom('beta@concent.io') | |
->setSubject('Invitation Request Accepted') | |
->setText('Lets stop fraud together!') | |
->setHtml(' ') // <-- triggers the html version of the template | |
// AND / OR | |
->setTemplateId($templateId); | |
; | |
$sendgrid->send($email); | |
// Or catch the error | |
try { | |
$sendgrid->send($email); | |
} catch(\SendGrid\Exception $e) { | |
echo $e->getCode(); | |
foreach($e->getErrors() as $er) { | |
echo $er; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment