curl 를 php curl 로 변환중인데 약간 문제가 있는것같아요..
본문
https://www.mailjet.com/email-api/
위에 curl를 이용해서 아래와같은 소스를 만들었습니다.
어떤이유에서인지 작동이 되지 않습니다..
어떤 이유일까요..;
<?php
$data = '{
"Messages":[
{
"From": {
"Email": "*** 개인정보보호를 위한 이메일주소 노출방지 ***",
"Name": "Mailjet Pilot"
},
"To": [
{
"Email": "*** 개인정보보호를 위한 이메일주소 노출방지 ***",
"Name": "passenger 1"
}
],
"Subject": "Your email flight plan!",
"TextPart": "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
"HTMLPart": "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!"
}
]
}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'xxxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, 'https://api.mailjet.com/v3.1/send');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$response = json_decode($response);
if($info['http_code'] != 200) {
return false;
} else {
return true;
}
?>
답변을 작성하시기 전에 로그인 해주세요.