These forums have been archived and are now read-only.

The new forums are live and can be found at

EVE Technology Lab

  • Topic is locked indefinitely.

Esi Mail Curl help..

Women Power Production Company
Respect Honor Passion Community
#1 - 2017-02-15 19:29:22 UTC  |  Edited by: Geuthur

I have some Problem i scriptet a php script but it doesnt work ....


$cost = 0;
$body = 'Test';
$rid = '94547377';
$rtype = 'characters';
$sub = 'test object';
$auth_code = '';

function curl_post_group()
    $ch = curl_init();
    $url = '';
    curl_setopt($ch, CURLOPT_URL, $url);
    $header = 'Authorization: Bearer ' . $auth_code;
    // headers
    curl_setopt($ch, CURLOPT_HTTPHEADER,  array($headers));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_POST, true);
    $post ["approved_cost"] = $cost;
    $post ["body"] = $body;
    $post ["recipients"] = array();
    $post ["recipients"] ["recipient_id"] = $rid;
    $post ["recipients"] ["recipient_type"] = $rtype;
    $post ["subject"] = $sub;
    $post = json_encode($post, JSON_UNESCAPED_UNICODE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
    $response = curl_exec($ch);
  $response = curl_exec($ch);
    if (curl_getinfo($ch) ["http_code"] != 201) {
        echo "Error";
        echo " HTTP_CODE:" . curl_getinfo($ch) ["http_code"];
    $response = json_decode($response);
    return $response;

thats the error i recieve

{"error": "'recipients' is required, 'subject' is required, 'body' is required, 'mail' is required"}
Women Power Production Company
Respect Honor Passion Community
#2 - 2017-02-16 14:41:22 UTC  |  Edited by: Geuthur
Daneel Trevize
Give my 11percent back
#3 - 2017-02-19 15:03:14 UTC
You're calling your function without passing in any parameters for $cost, etc. I'm not sure if they're in scope or not, but you should refactor it to not assume they are.

You're calling $response = curl_exec($ch); twice.
David Davaham
Deep Blue Logistics
#4 - 2017-02-21 01:21:26 UTC
Cleaned if up a little bit. Hopefully this helps. Good Luck

Developer of EVEmail

The Warp Core Stabilizers
Goonswarm Federation
#5 - 2017-02-21 05:41:43 UTC
You could have a look at Eseye to make these calls to ESI as wellI. An example can be seen here:

Proud developer of SeAT! A Simple Eve API & Corporation Management Tool.

Project Page: