I'm trying to send an email with PHP 7.1 via cURL. I receive the email but it doesn't have the subject, body (it's empty) and in "to" field I get "undisclosed recipients". Am I missing any parameters inside curl_setopt_array?
$postData = ["from" => John Doe,
"body" => "this is a test",
"to" => "xxxxxxxx@yyyyy.zzz",
"subject" => A simple test,
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'smtp.mydomain.com:25/mydomain.com',
CURLOPT_MAIL_FROM => '<no-reply@mydomain.com>',
CURLOPT_MAIL_RCPT => ['xxxxxxxx@yyyyy.zzz'],
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Content-Type: application/json"
),
curl_setopt($ch, CURLOPT_POST, true),
CURLOPT_POSTFIELDS => json_encode($postData),
CURLOPT_UPLOAD => true,
]);
curl_exec($ch);
curl_close($ch);