Php

  1. <?php

  2. $from ="example@yourcompany.in";

  3. $fromname ="Name";

  4. $to ="someone@yourcompany.in";//Recipients list (semicolon separated)

  5. $api_key ="YourApiKey";

  6. $subject ="Test Mail";

  7. $content ="This is my Mail Content";

  8. $data=array();

  9. $data['subject']= rawurlencode($subject);

  10. $data['fromname']= rawurlencode($fromname);

  11. $data['api_key']= $api_key;

  12. $data['from']= $from;

  13. $data['content']= rawurlencode($content);

  14. $data['recipients']= $to;

  15. $apiresult = callApi(@$api_type,@$action,$data);

  16. echo trim($apiresult);

  17. function callApi($api_type='', $api_activity='', $api_input=''){

  18.     $data = array();

  19.     $result = http_post_form("https://api.pepipost.com/api/web.send.rest", $api_input);

  20.     return $result;

  21. }

  22. function http_post_form($url,$data,$timeout=20){

  23.     $ch = curl_init();

  24.     curl_setopt($ch, CURLOPT_URL,$url);

  25.     curl_setopt($ch, CURLOPT_FAILONERROR,1);

  26.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);

  27.     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

  28.     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);

  29.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0);

  30.     curl_setopt($ch, CURLOPT_POST,1);

  31.     curl_setopt($ch, CURLOPT_RANGE,"1-2000000");

  32.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

  33.     curl_setopt($ch,  CURLOPT_REFERER,@$_SERVER['REQUEST_URI']);

  34.     $result = curl_exec($ch);

  35.     $result = curl_error($ch)? curl_error($ch): $result;

  36.     curl_close($ch);

  37.     return $result;

  38. }

  39. ?>