Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. // do send email here
  3. $url = 'https://api.sendgrid.com/';
  4. $user = 'telepro_api';
  5. $pass = 'TeleApi4.0';
  6.  
  7. $header = array(
  8. 'Authorization: Bearer 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',
  9. 'Content-Type: application/json'
  10. );
  11.  
  12. $params = array(
  13. 'personalizations' => array(
  14. 'to' => array('quang@telepro.me'),
  15. 'dynamic_template_data' => array(
  16. 'fullname' => 'A Quang',
  17. 'content' => 'test noi dung transactional email'
  18. )
  19. ),
  20. 'subject' => '[TelepPro] $$$ into your balance!',
  21. 'from' => 'no-reply@telepro.me',
  22. 'template_id' => 'd-5c385e95cf434715b0bb961979a8beed'
  23. );
  24.  
  25. $request = $url . 'v3/mail/send';
  26.  
  27. // Generate curl request
  28. $session = curl_init($request);
  29. curl_setopt ($session, CURLOPT_POST, true);
  30. curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
  31. curl_setopt($session, CURLOPT_HTTPHEADER, $header);
  32. curl_setopt($session, CURLOPT_HEADER, false);
  33. curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
  34. curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
  35.  
  36. // obtain response
  37. $response = curl_exec($session);
  38. curl_close($session);
  39.  
  40. var_dump($response);
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement