{"action":"created","issue":{"url":"https://api.github.com/repos/mailin-api/mailin-api-python/issues/17","repository_url":"https://api.github.com/repos/mailin-api/mailin-api-python","labels_url":"https://api.github.com/repos/mailin-api/mailin-api-python/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/mailin-api/mailin-api-python/issues/17/comments","events_url":"https://api.github.com/repos/mailin-api/mailin-api-python/issues/17/events","html_url":"https://github.com/mailin-api/mailin-api-python/issues/17","id":200245077,"number":17,"title":"Can't get send_email to work","user":{"login":"jayanth1991","id":1319597,"avatar_url":"https://avatars.githubusercontent.com/u/1319597?v=3","gravatar_id":"","url":"https://api.github.com/users/jayanth1991","html_url":"https://github.com/jayanth1991","followers_url":"https://api.github.com/users/jayanth1991/followers","following_url":"https://api.github.com/users/jayanth1991/following{/other_user}","gists_url":"https://api.github.com/users/jayanth1991/gists{/gist_id}","starred_url":"https://api.github.com/users/jayanth1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayanth1991/subscriptions","organizations_url":"https://api.github.com/users/jayanth1991/orgs","repos_url":"https://api.github.com/users/jayanth1991/repos","events_url":"https://api.github.com/users/jayanth1991/events{/privacy}","received_events_url":"https://api.github.com/users/jayanth1991/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-12T00:13:10Z","updated_at":"2017-01-12T13:11:11Z","closed_at":"2017-01-12T13:11:11Z","body":"Hi, I've been trying to follow the docs for sending an email via the library, what the documentation says contradicts what the sample code is doing.\r\n\r\n```py\r\n    from mailin import Mailin\r\n    m = Mailin(\"https://api.sendinblue.com/v2.0\",\"your access key\")\r\n\tdata = { \"to\" : {\"to@example.net\":\"to whom!\"},\r\n\t\t\"from\" : [\"from@email.com\", \"from email!\"],\r\n\t\t\"subject\" : \"My subject\",\r\n\t\t\"html\" : \"This is the \\<h1>HTML\\</h1>\",\r\n\t}\r\n \r\n\tresult = m.send_email(data)\r\n    print(result)\r\n```\r\n\r\nWhen I run this, I get `{u'message': u\"valid 'from' email address required\", u'code': u'failure', u'data': []}`\r\nWhen I change it to:\r\n```py\r\ndata['from'] = {'from@email.com\": 'From Email'}\r\n```\r\nIt complains about `json`\r\n\r\n```sh\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/mailin.py\", line 410, in send_email\r\n    return self.post(\"email\",json.dumps(data))\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/mailin.py\", line 36, in post\r\n    return self.do_request(resource,\"POST\",indata)\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/mailin.py\", line 30, in do_request\r\n    return response.json()\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/requests/models.py\", line 826, in json\r\n    return complexjson.loads(self.text, **kwargs)\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/simplejson/__init__.py\", line 516, in loads\r\n    return _default_decoder.decode(s)\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/simplejson/decoder.py\", line 374, in decode\r\n    obj, end = self.raw_decode(s)\r\n  File \"/home/ubuntu/test/env/local/lib/python2.7/site-packages/simplejson/decoder.py\", line 404, in raw_decode\r\n    return self.scan_once(s, idx=_w(s, idx).end())\r\nsimplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\r\n```\r\n\r\nThe documentation is not consistent with the example with regards to using an array:\r\nto\tEmail address of the recipient(s). It should be sent as an associative array. Example: array(“to@example.net”=>”to whom”). You can use commas to separate multiple recipients [Mandatory].\r\n\r\nfrom\tEmail address for From header. It should be sent as an array. Example: array(“from@email.com”,”from email”) [Mandatory].\r\n\r\nIf someone could point me in the right direction, that would be greatly appreciated.\r\n"},"comment":{"url":"https://api.github.com/repos/mailin-api/mailin-api-python/issues/comments/272159315","html_url":"https://github.com/mailin-api/mailin-api-python/issues/17#issuecomment-272159315","issue_url":"https://api.github.com/repos/mailin-api/mailin-api-python/issues/17","id":272159315,"user":{"login":"ekta-slit","id":5397089,"avatar_url":"https://avatars.githubusercontent.com/u/5397089?v=3","gravatar_id":"","url":"https://api.github.com/users/ekta-slit","html_url":"https://github.com/ekta-slit","followers_url":"https://api.github.com/users/ekta-slit/followers","following_url":"https://api.github.com/users/ekta-slit/following{/other_user}","gists_url":"https://api.github.com/users/ekta-slit/gists{/gist_id}","starred_url":"https://api.github.com/users/ekta-slit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekta-slit/subscriptions","organizations_url":"https://api.github.com/users/ekta-slit/orgs","repos_url":"https://api.github.com/users/ekta-slit/repos","events_url":"https://api.github.com/users/ekta-slit/events{/privacy}","received_events_url":"https://api.github.com/users/ekta-slit/received_events","type":"User","site_admin":false},"created_at":"2017-01-12T13:11:11Z","updated_at":"2017-01-12T13:11:11Z","body":"Hello @jayanth1991 \r\n\r\nThank you for contacting us.\r\nThe sample provided in the documentation & the same used by you is totally correct.\r\n`\r\nfrom mailin import Mailin\r\n    m = Mailin(\"https://api.sendinblue.com/v2.0\",\"your access key\")\r\n\tdata = { \"to\" : {\"to@example.net\":\"to whom!\"},\r\n\t\t\"from\" : [\"from@email.com\", \"from email!\"],\r\n\t\t\"subject\" : \"My subject\",\r\n\t\t\"html\" : \"This is the \\<h1>HTML\\</h1>\",\r\n\t}\r\n \r\n    result = m.send_email(data)\r\n    print(result)`\r\n\r\nBut if you still face the `from` field validation error, please contact our [support team](https://account.sendinblue.com/support) by raising a ticket to look into the issue further.\r\n\r\nRegards\r\nSendinBlue Team\r\n"}}
{"actor":{"display_login":"ekta-slit"}}