You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We spent hours on Mailgun's inconsistent documentation for PHP with multiple steps to get proper libraries in place. God forbid you install Composer as root and all hell breaks loose. Don't make the same mistake we did if you've had any trouble using Mailgun's convoluted PHP library setup and install. Just use CURL directly. As seen in the code below:
$api_key="your api key";/* Api Key got from https://mailgun.com/cp/my_account/
$domain ="mydomain.com";/ Domain Name you given to Mailgun */
$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_POSTFIELDS, array(
'from' => 'Open contact@mydomain.com',
'to' => $email,
'subject' => 'Patient questionnaire result',
'html' => ''
));
$result = curl_exec($ch);
curl_close($ch);
return $result;
The text was updated successfully, but these errors were encountered:
We spent hours on Mailgun's inconsistent documentation for PHP with multiple steps to get proper libraries in place. God forbid you install Composer as root and all hell breaks loose. Don't make the same mistake we did if you've had any trouble using Mailgun's convoluted PHP library setup and install. Just use CURL directly. As seen in the code below:
$api_key="your api key";/* Api Key got from https://mailgun.com/cp/my_account /
$domain ="mydomain.com";/ Domain Name you given to Mailgun */
$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_POSTFIELDS, array(
'from' => 'Open contact@mydomain.com',
'to' => $email,
'subject' => 'Patient questionnaire result',
'html' => ''
));
$result = curl_exec($ch);
curl_close($ch);
return $result;
The text was updated successfully, but these errors were encountered: