0xV3NOMx
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.55.25


Current Path : /var/www/html/collportal/src/
Upload File :
Current File : //var/www/html/collportal/src/sendGridMail.php

<?php

error_reporting(E_ALL);
/*$json_string = array(

  'to' => array(
    'example1@sendgrid.com', 'example2@sendgrid.com'
  ),
  'category' => 'test_category'
);
*/
// var_dump("ygvhjbk");
  // die();

function sendGridMail($to, $subject, $html, $univcode,$cc)
{
  
  if($univcode == "051"){
    $from = "coe.qp@dypatil.edu";
  }else if($univcode == 'P005'){
    $from = 'Admissions@harshaintitutions.com';
  }else{
    $from = 'support@uniclare.com';
  }

 
  if($cc != '')
  {
    $params = array(

      'to'        => $to,
      'subject'   => $subject,
      'html'      => $html,
      'from'      => $from,
      'cc' =>$cc
    );
    
  }else
  {
    $params = array(

      'to'        => $to,
      'subject'   => $subject,
      'html'      => $html,
      'from'      => $from
    );
  }

  $url = 'https://api.sendgrid.com/';

  $token = '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';
 

  $request =  $url . 'api/mail.send.json';
  $headr = array();
  $headr[] = 'Authorization: Bearer ' . $token;
  // 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);

  curl_setopt($session, CURLOPT_HTTPHEADER, $headr);

  // obtain response
  $response = curl_exec($session);
  curl_close($session);

  // print everything out
  return $response;
}