Skip to content

Instantly share code, notes, and snippets.

@ErMandeep
Created November 17, 2020 17:53
Show Gist options
  • Save ErMandeep/36da92f2b66f445693889d93a9c70ee2 to your computer and use it in GitHub Desktop.
Save ErMandeep/36da92f2b66f445693889d93a9c70ee2 to your computer and use it in GitHub Desktop.
sendinblue email by curl
<?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);
?>
@Suny-ticket
Copy link

superb

@ebalmaceda
Copy link

Your a fuck#ng hero!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment