1
Mail Gun을 통해 첨부 파일이있는 이메일을 보내려는 api를 실행하는 중 일부 문제가 있습니다. 우편 배달부를 통해 api를 실행하려고했는데 완벽하게 실행되어 문제가없는 것으로 알고 있습니다. api하지만 코드를 통해 요청을 보낼 수 없습니다.HTTP를 통해 Mailgun으로 이메일 보내기 Curl을 사용하여 요청
나는 코드 예제 아래에 추가 한 :
<?php
$curl_post_data=array(
'from' => 'Excited User <[email protected]>',
'to' => '[email protected]',
'subject' => 'Hello',
'text' => 'test'
//,'attachment[1]' => '@https://www.smsglobal.com/docs/HTTP-2WAY.pdf'
,array('attachment' => 'https://www.smsglobal.com/docs/HTTP-2WAY.pdf')
);
$service_url = 'https://api.mailgun.net/v3/test.com/messages';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "api:key-testtesttesttes");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$curl_response = curl_exec($curl);
$response = json_decode($curl_response);
curl_close($curl);
var_dump($response);
?>