Guest User

Untitled

a guest
Jul 17th, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. $to = $customerEmail;
  2. $from = config_item('email_from');
  3. $url = 'https://api.sendgrid.com/';
  4. $user = 'abhishekp';
  5. $pass = 'abhishekp@123';
  6. $params = array(
  7. 'api_user' => $user,
  8. 'api_key' => $pass,
  9. 'to' => $to,
  10. 'fromname' => 'DreamsOffers',
  11. 'from' => $from,
  12. 'subject' => $subject,
  13. 'html' => $content);
  14.  
  15. $request = $url . 'api/mail.send.json';
  16. // Generate curl request
  17. $session = curl_init($request);
  18. // Tell curl to use HTTP POST
  19. curl_setopt($session, CURLOPT_POST, true);
  20. // Tell curl that this is the body of the POST
  21. curl_setopt($session, CURLOPT_POSTFIELDS, $params);
  22. // Tell curl not to return headers, but do return the response
  23. curl_setopt($session, CURLOPT_HEADER, false);
  24. // Tell PHP not to use SSLv3 (instead opting for TLS)
  25. //curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
  26. curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
  27. curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
  28.  
  29. // obtain response
  30. $response = curl_exec($session);
  31. curl_close($session);
Add Comment
Please, Sign In to add comment