How do I submit an application using mailgun?
I am trying to send an attachment using curl
via mailgun
, but its sending an email without the attachment. (I only receive email with part of the html, but no attachments). Here is my code
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'api:'.$api_key);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_URL, 'https://api.mailgun.net/v3/'.$domain.'/messages');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
$result = curl_exec($ch);
curl_close($ch);
return $result;
$postFields
is an array with the following value.
Array
(
[from] => ***
[to] => ***
[subject] => ***
[html] => ***
[attachment] => Array
(
[0] => /home/***/n.jpg
[1] => /home/***/n2.jpg
)
)
+3
salin kunwar
source
to share
No one has answered this question yet
See similar questions:
44
or similar:
2480
2263
895
five
4
3
2
2
0
0