Created
December 7, 2016 14:34
-
-
Save mvrmoreira/3bf1507f19292c5efab20f5e0d3fd47f 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 | |
// RECEBE OS DADOS DO MEDIDOR | |
$vazao = $_REQUEST['vazao']; | |
// TODO: FAZER A LOGICA QUE VAI DECIDIR SE DISPARA OU NAO O EMAIL | |
// MONTA E CONFIGURA O EMAIL A SER ENVIADO | |
require 'vendor/autoload.php'; | |
$from = new SendGrid\Email("Example User", "[email protected]"); | |
$subject = "Resultado do Medidor"; | |
$to = new SendGrid\Email("Matheus Moreira", "[email protected]"); | |
$content = new SendGrid\Content("text/plain", "Vazão: ".$vazao); | |
$mail = new SendGrid\Mail($from, $subject, $to, $content); | |
$apiKey = getenv('SENDGRID_API_KEY'); | |
// DISPARA O EMAIL | |
$sg = new \SendGrid($apiKey); | |
$sg->client->mail()->send()->post($mail); | |
echo "OK"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment