Connection rejected error in curl when calling mandrill api

To send transactional email using mandrill api, I use this mandrill api -

https://mandrillapp.com/api/1.0/messages/send.json

And I'm trying to post JSON data (payload) to it -

{
'key' : 'MyActualKey',
'message': {
    'html': '<p>Example HTML content</p>',
    'text': 'Example text content',
    'subject': 'example subject',
    'from_email': 'from@example.com',
    'from_name': 'Test',
    'to': [
        {
            'email': 'to@example.com',
            'name': 'Hussain',
            'type': 'to'
        }
    ],
    'headers': {
        'Reply-To': 'reply@example.com'
    },
    'merge': True,
    'tags': [
        'Mandrill Test'
    ]
 },
'ip_pool': 'Main Pool'
}

So, when I execute this curl command -

curl -X POST -H "Content-Type: application/json" --data @TestMandrillPayload.json https://mandrillapp.com/api/1.0/messages/send.json -v

I get this error -

* About to connect() to proxy 127.0.0.1 port 8000 (#0)
*   Trying 127.0.0.1... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host

But when I use the same json here -

https://mandrillapp.com/api/docs/messages.JSON.html#method-send

the letter is sent successfully.

I tried to find the cause of this problem on the Internet. Everyone says that something is wrong with my DNS or my firewall. What's wrong with it?

+3
source share
1 answer

If its a DNS problem, then ping the domain mandrillapp.comand get the IP address and use it for curling.

IP- DNS-, curl.

--dns-servers IP

, -k curl.

0

All Articles