Note that there are some explanatory texts on larger screens.

plurals
  1. POMailgun Sent mail With attachment
    text
    copied!<p>I am facing issue when mail having attachment sent using mailgun. If anyone has done this thing please reply. This is my code...</p> <pre><code>$mg_api = 'key-3ax6xnjp29jd6fds4gc373sgvjxteol0'; $mg_version = 'api.mailgun.net/v2/'; $mg_domain = "samples.mailgun.org"; $mg_from_email = "info@samples.com"; $mg_reply_to_email = "info@samples.org"; $mg_message_url = "https://".$mg_version.$mg_domain."/messages"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt ($ch, CURLOPT_MAXREDIRS, 3); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_VERBOSE, 0); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_USERPWD, 'api:' . $mg_api); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); //curl_setopt($curl, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_HEADER, false); //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_URL, $mg_message_url); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'from' =&gt; 'aaaa &lt;' . 'aaa@aaa.com' . '&gt;', 'to' =&gt; 'test.client91@gmail.com', 'h:Reply-To'=&gt; ' &lt;' . $mg_reply_to_email . '&gt;', 'subject' =&gt; 'aaaaa'.time(), 'html' =&gt; 'aaaaaa', 'attachment'[1] =&gt; 'aaa.rar' )); $result = curl_exec($ch); curl_close($ch); $res = json_decode($result,TRUE); print_r($res); </code></pre> <p>(I have used my mailgun settings)</p> <p>I receive the email without the attachment. If I use the URL path it displays the URL instead of the attachment.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload