Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't bother with Mailgun's convoluted library setup. Use PHP CURL directly instead. #468

Closed
ffjabre opened this issue Jul 11, 2018 · 1 comment

Comments

@ffjabre
Copy link

ffjabre commented Jul 11, 2018


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;

@Nyholm
Copy link
Collaborator

Nyholm commented Jul 11, 2018

I’m sorry you had a hard time using this library. I can understand it is tricky if you don’t know composer.

Even if you don’t like it, learning to use composer may save you “hours of work” achieving simple tasks in the future.

I’m closing this since it is not really an issue.

@Nyholm Nyholm closed this as completed Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants