I'm using sengrid api to send mails and i installed curl and WAMP server. mail sttus code is 0 and body and header is empty. how to solve this issue.?
i tried php version 7.1 and 7.2 but it doesn't work
$email = new \SendGrid\Mail\Mail();
$email->setFrom("donayasara94@gmail.com", $subject);
$email->setSubject($subject);
$email->addTo($receiver, $subject);
$email->addContent("text/plain", $body);
$email->addContent(
"text/html", $body
);
$sendgrid = new \SendGrid('api key');
try {
$response = $sendgrid->send($email);
$returnArr = [
'code' => $response->statusCode(),
'body' => $response->body()
];
echo json_encode($returnArr);
print $response->statusCode() . "
";
print_r($response->headers());
print $response->body() . "
";
} catch (Exception $e) {
//echo 'Caught exception: ' . $e->getMessage() . "
";
} /*end sending email*/
}