Created
November 17, 2020 17:53
-
-
Save ErMandeep/36da92f2b66f445693889d93a9c70ee2 to your computer and use it in GitHub Desktop.
sendinblue email by curl
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 | |
$data = array( | |
"sender" => array( | |
"email" => '[email protected]', | |
"name" => 'sender email' | |
), | |
"to" => array( | |
array( | |
"email" => "[email protected]", | |
"name" => "Your - name" | |
) | |
), | |
"subject" => 'new tsting for the', | |
"htmlContent" => '<html><head></head><body><p>Hello,</p>This is my first transactional email sent from Sendinblue.</p></body></html>' | |
); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'https://api.sendinblue.com/v3/smtp/email'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); | |
$headers = array(); | |
$headers[] = 'Accept: application/json'; | |
$headers[] = 'Api-Key: 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'; | |
$headers[] = 'Content-Type: application/json'; | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
$result = curl_exec($ch); | |
if (curl_errno($ch)) { | |
echo 'Error:' . curl_error($ch); | |
} | |
curl_close($ch); | |
print_r($result); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your a fuck#ng hero!