Giter Club home page Giter Club logo

Comments (9)

challgren avatar challgren commented on May 29, 2024

This sounds like your corporate network maybe filtering/blocking connections to Mailgun. Can you try opening your browser and going to https://api.mailgun.net/v3/example.com/messages you should see a 405 Method Not Allowed.

from cakephp-mailgun.

peiblox avatar peiblox commented on May 29, 2024

Yes, I see that. What does it mean?

from cakephp-mailgun.

challgren avatar challgren commented on May 29, 2024

Are you connected to the corporate network or a different network?

from cakephp-mailgun.

peiblox avatar peiblox commented on May 29, 2024

I'm connected to the corporate network right now.

from cakephp-mailgun.

narendravaghela avatar narendravaghela commented on May 29, 2024

@peiblox Please check your error logs for more details - logs/error.log and logs/debug.log.

Also to make sure http calls using curl are working, try to run following code from anywhere in your application e.g. controller's action.

use Cake\Http\Client;

$http = new Client();
$response = $http->post("https://api.mailgun.net/v3/example.com/messages", '', [
    'auth' => ['username' => 'api', 'password' => 'password']
]);
debug($response->getJson());

Replace example.com with your domain name and password with your api key.
This might give you a better idea on what is going on while making an HTTP request via curl and cake's HTTP client.

from cakephp-mailgun.

peiblox avatar peiblox commented on May 29, 2024

Hi,
I've just tried what you said and the error log is pretty much showing the same results as the screenshot I posted before.

Here is the error using the plugin.

2019-07-25 09:41:32 Error: [Cake\Http\Exception\HttpException] cURL Error (28) Resolving timed out after 30070 milliseconds
#0 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(445): Cake\Http\Client\Adapter\Curl->send(Object(Cake\Http\Client\Request), Array)
#1 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(414): Cake\Http\Client->_sendRequest(Object(Cake\Http\Client\Request), Array)
#2 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(381): Cake\Http\Client->send(Object(Cake\Http\Client\Request), Array)
#3 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(264): Cake\Http\Client->_doRequest('POST', 'https://api.mai...', '--3974ada5d4dd7...', Array)
#4 /my-project/vendor/narendravaghela/cakephp-mailgun/src/Mailer/Transport/MailgunTransport.php(380): Cake\Http\Client->post('https://api.mai...', '--3974ada5d4dd7...', Array)
#5 /my-project/vendor/narendravaghela/cakephp-mailgun/src/Mailer/Transport/MailgunTransport.php(156): Mailgun\Mailer\Transport\MailgunTransport->_sendEmail()
#6 /my-project/vendor/cakephp/debug_kit/src/Mailer/Transport/DebugKitTransport.php(79): Mailgun\Mailer\Transport\MailgunTransport->send(Object(Mailgun\Mailer\MailgunEmail))
#7 /my-project/vendor/cakephp/cakephp/src/Mailer/Email.php(2140): DebugKit\Mailer\Transport\DebugKitTransport->send(Object(Mailgun\Mailer\MailgunEmail))
#8 /my-project/vendor/cakephp/cakephp/src/Mailer/Mailer.php(308): Cake\Mailer\Email->send()
#9 /my-project/plugins/Neo/FormsManager/src/Controller/FormsController.php(223): Cake\Mailer\Mailer->send('submit', Array)
#10 /my-project/vendor/cakephp/cakephp/src/Controller/Controller.php(610): Neo\FormsManager\Controller\FormsController->edit('1')
#11 /my-project/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(120): Cake\Controller\Controller->invokeAction()
#12 /my-project/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(94): Cake\Http\ActionDispatcher->_invoke(Object(Neo\FormsManager\Controller\FormsController))
#13 /my-project/vendor/cakephp/cakephp/src/Http/BaseApplication.php(235): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#14 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#15 /my-project/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(162): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#16 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#17 /my-project/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#18 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#19 /my-project/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(96): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#20 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#21 /my-project/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php(53): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#22 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): DebugKit\Middleware\DebugKitMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#23 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#24 /my-project/vendor/cakephp/cakephp/src/Http/Server.php(98): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#25 /my-project/webroot/index.php(40): Cake\Http\Server->run()
#26 {main}
Request URL: /forms-manager/forms/edit/1
Referer URL: http://localhost/my-project/forms-manager/forms

Here is the error using the HTTP Client directly:

2019-07-25 09:44:43 Error: [Cake\Http\Exception\HttpException] cURL Error (28) Resolving timed out after 30064 milliseconds
#0 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(445): Cake\Http\Client\Adapter\Curl->send(Object(Cake\Http\Client\Request), Array)
#1 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(414): Cake\Http\Client->_sendRequest(Object(Cake\Http\Client\Request), Array)
#2 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(381): Cake\Http\Client->send(Object(Cake\Http\Client\Request), Array)
#3 /my-project/vendor/cakephp/cakephp/src/Http/Client.php(264): Cake\Http\Client->_doRequest('POST', 'https://api.mai...', '', Array)
#4 /my-project/plugins/Neo/FormsManager/src/Controller/FormsController.php(215): Cake\Http\Client->post('https://api.mai...', '', Array)
#5 /my-project/vendor/cakephp/cakephp/src/Controller/Controller.php(610): Neo\FormsManager\Controller\FormsController->edit('1')
#6 /my-project/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(120): Cake\Controller\Controller->invokeAction()
#7 /my-project/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(94): Cake\Http\ActionDispatcher->_invoke(Object(Neo\FormsManager\Controller\FormsController))
#8 /my-project/vendor/cakephp/cakephp/src/Http/BaseApplication.php(235): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#9 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#10 /my-project/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(162): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#11 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#12 /my-project/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#13 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#14 /my-project/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(96): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#15 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#16 /my-project/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php(53): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#17 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(65): DebugKit\Middleware\DebugKitMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#18 /my-project/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#19 /my-project/vendor/cakephp/cakephp/src/Http/Server.php(98): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#20 /my-project/webroot/index.php(40): Cake\Http\Server->run()
#21 {main}
Request URL: /forms-manager/forms/edit/1
Referer URL: http://localhost/my-project/forms-manager/forms

I'm using cURL in other parts of my app to connect to other services and I'm not having any issue, so I don't think it's a cURL problem itself.

For any reason, is only happening with the Mailgun API and my Mac connected to the corporate network.

Thank you both for your help.

from cakephp-mailgun.

challgren avatar challgren commented on May 29, 2024

Did you ever resolve this?

from cakephp-mailgun.

peiblox avatar peiblox commented on May 29, 2024

I've doing some tests but couldn't resolve this.

I had the same issue with the official mailgun-php library, but reinstalling using the recommended libraries solved the problem. I was using the php-http/guzzle6-adapter library. Removing that resolved the problem with mailgun-php library.

However, the error remains the same with de cakephp-mailgun library and I wasn't able to figure out why it keeps happening.

Do you know if I can use another libraries to connect the cakephp-mailgun library with the Mailgun API?

Thanks!

from cakephp-mailgun.

challgren avatar challgren commented on May 29, 2024

Hmm thats strange, we haven't heard of anyone else having the issue. You could just use the built in HttpClient that CakePHP provides. Sorry we couldn't help out with your issue.

from cakephp-mailgun.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.