Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.103.119
<?php
error_reporting(E_ALL);
/*$json_string = array(
'to' => array(
'example1@sendgrid.com', 'example2@sendgrid.com'
),
'category' => 'test_category'
);
*/
function sendGridMail($to,$subject,$html,$cc)
{
$url = 'https://api.sendgrid.com/';
$user = 'logisys2013';
$pass = 'P@ssw0rd2104';
if($cc == '')
$cc = "bcureply@gmail.com";
$params = array(
'api_user' => $user,
'api_key' => $pass,
'to' => $to,
'subject' => $subject,
'html' => $html,
'from' => 'support@uniclare.com',
'cc' => $cc,
);
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
// Tell PHP not to use SSLv3 (instead opting for TLS)
//curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
curl_close($session);
// print everything out
return $response;
}
|