上で実行されていないグリッドのメールAPIを送信します。カール関数または私は電子メールを送信するために、以前にこのコードを使用していた私のサーバー
<?php
$tos='[email protected]';
$subject09='hello madam223';
$messageto90='this is a test';
$myName_emailis='Sonam ';
$emaillist_act=array('[email protected]','[email protected]');
$json_string = array('to' =>$emaillist_act,'category' => 'activity');
$url = 'https://api.sendgrid.com/';
$user = 'username';
$pass = 'password';
$params = array(
'api_user' => $user,
'api_key' => $pass,
'x-smtpapi' => json_encode($json_string),
'to' => "$tos",
'subject' => "$subject09",
'html' => "$messageto90",
'fromname' => $myName_emailis,
'from' => "domain.com <[email protected]>"
);
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
// Tell PHP not to use SSLv3 (instead opting for TLS)
@curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
curl_close($session);
print_r($response);
?>
しかし今、同じコードが何もしません。応答を印刷したり、電子メールを送信したりすることはありません。
私は私がカール機能でそれを確認して自分のサーバーにインストールし、
function _is_curl_installed() {
if (in_array ('curl', get_loaded_extensions())) {
return true;
}
else {
return false;
}
}
そして、それは本当の私を示していないことが、カールかもしれないと思った。..
考えられる理由何ができますか?私を助けてください。 それはまだ問題があるかもしれない私のサーバーではなく、他のサーバー上で成功メッセージを印刷していますか?
私は同じコードが多くのドメインに存在しているとして、私は、コードを変更するカントのparamater https://sendgrid.com/docs/Integrate/Code_Examples/php.html – JiteshNK