{"__v":5,"_id":"57a1c374d778850e0047e273","category":{"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","_id":"57a9cf4e944ea60e00dc3f74","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-08-09T12:40:46.182Z","from_sync":false,"order":6,"slug":"email-messages","title":"Email messages"},"parentDoc":null,"project":"54eb50e5615ffc1900305a16","user":"54eb4fdedf7add210007b29b","version":{"__v":18,"_id":"54eb63b859b1172100334fae","forked_from":"54eb63a1867e1917009b711d","project":"54eb50e5615ffc1900305a16","createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-03T10:12:04.556Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"curl","code":"curl -s --user user:password \\\nhttps://api.infobip.com/email/1/send \\\n-F from='Jane Smith <jane.smith:::at:::somecompany.com>' \\\n-F to='john.smith@somedomain.com' \\\n-F subject='Mail subject text' \\\n-F text='Mail body text' \\\n--form-string html='<h1>Html body</h1><p>Rich HTML message body.</p>' \\\n-F attachment=@files/image1.jpg"},{"code":"POST /email/1/send HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic bWt1dGljMjpNdTtpMjAxMiws\nAccept: application/json\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\n\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"from\"\n\nJane Doe <jane.doe@somecompany.com>\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"to\"\n\njohn.smith@somecompany.com\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"subject\"\n\nTest mail subject\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"text\"\n\nSimple text body\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"html\"\n\n<h1>Html body</h1><p>Rich HTML message body.</p>\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"attachment\"; filename=\"image1.jpg\"\nContent-Type: application/x-object\n\n... contents of file goes here ...\n------WebKitFormBoundary7MA4YWxkTrZu0gW--","language":"http","name":null},{"code":"<?php\n// PHP 5.5+, don't forget to enable php_curl extension!\n\n$file_location = \"/path/to/file\";\n\n$postData = array(\n    \"from\" => \"sender@example.com\",\n    \"to\" => \"receiver@example.com\",\n    \"subject\" => \"Subject\",\n    \"text\" => \"Text\",\n    \"html\" => \"<html><body><p>Paragraph1</p><p>Paragraph2</p></body></html>\",\n    \"attachment\" => new \\CURLFile($file_location, \"application/octet-stream\", 'filename.txt'));\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.infobip.com/email/1/send');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));\ncurl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\ncurl_setopt($ch, CURLOPT_USERPWD, \"username:password\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_POST, TRUE);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $postData);\ncurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\n$curlResult= curl_exec($ch);\n\n?>","language":"php"}]},"results":{"codes":[{"name":"","code":"{\n  \"messages\": [\n    {\n      \"to\": \"jane.smith@somecompany.com\",\n      \"messageCount\": 1,\n      \"messageId\": \"c268350e-c85e-41d1-b5a0-a60771b134bd\",\n      \"status\": {\n        \"groupId\": 1,\n        \"groupName\": \"PENDING\",\n        \"id\": 7,\n        \"name\": \"PENDING_ENROUTE\",\n        \"description\": \"Message sent to next instance\"\n      }\n    }\n  ]\n}","language":"json","status":200}]},"settings":"554860d6d2c8410d006c215e","auth":"required","params":[{"_id":"57a1b44e5220910e002a16c0","ref":"","in":"body","required":false,"desc":"Email address with optional sender name. Example: \"Jane Smith <<jane.smith@somecompany.com>>\"","default":"","type":"string","name":"from"},{"_id":"57a1b44e5220910e002a16bf","ref":"","in":"body","required":false,"desc":"Email address of the recipient","default":"","type":"string","name":"to"},{"_id":"57a1b44e5220910e002a16be","ref":"","in":"body","required":false,"desc":"Message subject","default":"","type":"string","name":"subject"},{"_id":"57a1b44e5220910e002a16bd","ref":"","in":"body","required":false,"desc":"Body of the message","default":"","type":"string","name":"text"},{"_id":"57a1c927f724ae1900df48b2","ref":"","in":"body","required":false,"desc":"HTML body of the message. If html and text fields are present, text field will be ignored and html will be delivered as message body","default":"","type":"string","name":"html"},{"_id":"57a1caa3d778850e0047e27a","ref":"","in":"body","required":false,"desc":"File attachment","default":"","type":"file","name":"attachment"}],"url":"/email/:version/send"},"isReference":true,"order":2,"body":"# Response format\n\nOn success, response header HTTP status code will be `200 OK` and the message will be sent.\n\nIf you try to send message without authorization, you will receive an error `401 Unauthorized`.\n\n### Response\n\n|Parameter|Type|Description|\n|-|-|-|\n|*messages*|MessageInfo[]|Array of sent message objects, one object per every message.|\n\n### MessageInfo\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|String|The message destination address.|\n|*status*|[Status](#section-status)|Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.|\n|*messageCount*|int|The number of sent message segments.|\n|*messageId*|String|The ID that uniquely identifies the message sent.|\n\n#### Status\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#section-status-object-example).|\n|*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.|\n|*action*|String|[Action](http://dev.infobip.com/v1/docs/response-codes#status-object-example) that should be taken to eliminate the error.|\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Send email to multiple recipients\"\n}\n[/block]\nYou can easily send the same email to multiple recipient addresses by including more then one **to **parameters in the request\n##Example\nRequest:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -s --user user:password \\\\\\nhttps://api.infobip.com/email/1/send \\\\\\n-F from='Jane Smith <jane.smith@somecompany.com>' \\\\\\n-F to='john.smith@somedomain.com' \\\\\\n-F to='tom.smith@somedomain.com' \\\\\\n-F subject='Mail subject text' \\\\\\n-F text='Mail body text' \\\\\\n--form-string html='<h1>Html body</h1><p>Rich HTML message body.</p>' \\\\\\n-F attachment=@files/image1.jpg\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"POST /email/1/send HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic bWt1dGljMjpNdTtpMjAxMiws\\nAccept: application/json\\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\\n\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"from\\\"\\n\\nJane Doe <jane.doe@somecompany.com>\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"to\\\"\\n\\njohn.smith@somecompany.com\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"to\\\"\\n\\njane.smith@somecompany.com\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"subject\\\"\\n\\nTest mail subject\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"text\\\"\\n\\nSimple text body\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"html\\\"\\n\\n<h1>Html body</h1><p>Rich HTML message body.</p>\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"attachment\\\"; filename=\\\"image1.jpg\\\"\\nContent-Type: application/x-object\\n\\n... contents of file goes here ...\\n------WebKitFormBoundary7MA4YWxkTrZu0gW--\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"messages\\\": [\\n    {\\n      \\\"to\\\": \\\"john.smith@somecompany.com\\\",\\n      \\\"messageCount\\\": 1,\\n      \\\"messageId\\\": \\\"9129e972-be85-49ed-b0e9-f51fbd2b27c0\\\",\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 7,\\n        \\\"name\\\": \\\"PENDING_ENROUTE\\\",\\n        \\\"description\\\": \\\"Message sent to next instance\\\"\\n      }\\n    },\\n    {\\n      \\\"to\\\": \\\"tom.smith@somecompany.com\\\",\\n      \\\"messageCount\\\": 1,\\n      \\\"messageId\\\": \\\"cd0c5682-42e2-481a-be95-15ed72450646\\\",\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 7,\\n        \\\"name\\\": \\\"PENDING_ENROUTE\\\",\\n        \\\"description\\\": \\\"Message sent to next instance\\\"\\n      }\\n    }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Send email with multiple attachments\"\n}\n[/block]\nSending email with more than one attachment is done by adding multiple attachment parameters in the request.\n##Example\nRequest:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -s --user user:password \\\\\\nhttps://api.infobip.com/email/1/send \\\\\\n-F from='Jane Smith <jane.smith@somecompany.com>' \\\\\\n-F to='john.smith@somedomain.com' \\\\\\n-F subject='Mail subject text' \\\\\\n-F text='Mail body text' \\\\\\n--form-string html='<h1>Html body</h1><p>Rich HTML message body.</p>' \\\\\\n-F attachment=@files/image1.jpg\\n-F attachment=@files/image2.jpg\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"POST /email/1/send HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic bWt1dGljMjpNdTtpMjAxMiws\\nAccept: application/json\\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\\n\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"from\\\"\\n\\nJane Doe <jane.doe@somecompany.com>\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"to\\\"\\n\\njohn.smith@somecompany.com\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"subject\\\"\\n\\nTest mail subject\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"text\\\"\\n\\nSimple text body\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"html\\\"\\n\\n<h1>Html body</h1><p>Rich HTML message body.</p>\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"attachment\\\"; filename=\\\"image1.jpg\\\"\\nContent-Type: application/x-object\\n\\n... contents of file goes here ...\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\nContent-Disposition: form-data; name=\\\"attachment\\\"; filename=\\\"image2.jpg\\\"\\nContent-Type: application/x-object\\n\\n... contents of file goes here ...\\n------WebKitFormBoundary7MA4YWxkTrZu0gW--\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"messages\\\": [\\n    {\\n      \\\"to\\\": \\\"john.smith@somecompany.com\\\",\\n      \\\"messageCount\\\": 1,\\n      \\\"messageId\\\": \\\"c268350e-c85e-41d1-b5a0-a60771b134bd\\\",\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 7,\\n        \\\"name\\\": \\\"PENDING_ENROUTE\\\",\\n        \\\"description\\\": \\\"Message sent to next instance\\\"\\n      }\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"This method allows you to send one or more email message with attachments to one or more destination addresses.","slug":"fully-featured-email","type":"post","title":"Fully featured email"}

postFully featured email

This method allows you to send one or more email message with attachments to one or more destination addresses.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

from:
string
Email address with optional sender name. Example: "Jane Smith <<jane.smith@somecompany.com>>"
to:
string
Email address of the recipient
subject:
string
Message subject
text:
string
Body of the message
html:
string
HTML body of the message. If html and text fields are present, text field will be ignored and html will be delivered as message body
attachment:
file
File attachment

Examples


Result Format


Documentation

# Response format On success, response header HTTP status code will be `200 OK` and the message will be sent. If you try to send message without authorization, you will receive an error `401 Unauthorized`. ### Response |Parameter|Type|Description| |-|-|-| |*messages*|MessageInfo[]|Array of sent message objects, one object per every message.| ### MessageInfo |Parameter|Type|Description| |-|-|-| |*to*|String|The message destination address.| |*status*|[Status](#section-status)|Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.| |*messageCount*|int|The number of sent message segments.| |*messageId*|String|The ID that uniquely identifies the message sent.| #### Status |Parameter|Type|Description| |-|-|-| |*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#section-status-object-example).| |*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.| |*action*|String|[Action](http://dev.infobip.com/v1/docs/response-codes#status-object-example) that should be taken to eliminate the error.| [block:api-header] { "type": "post", "title": "Send email to multiple recipients" } [/block] You can easily send the same email to multiple recipient addresses by including more then one **to **parameters in the request ##Example Request: [block:code] { "codes": [ { "code": "curl -s --user user:password \\\nhttps://api.infobip.com/email/1/send \\\n-F from='Jane Smith <jane.smith@somecompany.com>' \\\n-F to='john.smith@somedomain.com' \\\n-F to='tom.smith@somedomain.com' \\\n-F subject='Mail subject text' \\\n-F text='Mail body text' \\\n--form-string html='<h1>Html body</h1><p>Rich HTML message body.</p>' \\\n-F attachment=@files/image1.jpg", "language": "curl" }, { "code": "POST /email/1/send HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic bWt1dGljMjpNdTtpMjAxMiws\nAccept: application/json\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\n\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"from\"\n\nJane Doe <jane.doe@somecompany.com>\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"to\"\n\njohn.smith@somecompany.com\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"to\"\n\njane.smith@somecompany.com\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"subject\"\n\nTest mail subject\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"text\"\n\nSimple text body\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"html\"\n\n<h1>Html body</h1><p>Rich HTML message body.</p>\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"attachment\"; filename=\"image1.jpg\"\nContent-Type: application/x-object\n\n... contents of file goes here ...\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", "language": "http" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"messages\": [\n {\n \"to\": \"john.smith@somecompany.com\",\n \"messageCount\": 1,\n \"messageId\": \"9129e972-be85-49ed-b0e9-f51fbd2b27c0\",\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 7,\n \"name\": \"PENDING_ENROUTE\",\n \"description\": \"Message sent to next instance\"\n }\n },\n {\n \"to\": \"tom.smith@somecompany.com\",\n \"messageCount\": 1,\n \"messageId\": \"cd0c5682-42e2-481a-be95-15ed72450646\",\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 7,\n \"name\": \"PENDING_ENROUTE\",\n \"description\": \"Message sent to next instance\"\n }\n }\n ]\n}", "language": "json", "name": null } ] } [/block] [block:api-header] { "type": "post", "title": "Send email with multiple attachments" } [/block] Sending email with more than one attachment is done by adding multiple attachment parameters in the request. ##Example Request: [block:code] { "codes": [ { "code": "curl -s --user user:password \\\nhttps://api.infobip.com/email/1/send \\\n-F from='Jane Smith <jane.smith@somecompany.com>' \\\n-F to='john.smith@somedomain.com' \\\n-F subject='Mail subject text' \\\n-F text='Mail body text' \\\n--form-string html='<h1>Html body</h1><p>Rich HTML message body.</p>' \\\n-F attachment=@files/image1.jpg\n-F attachment=@files/image2.jpg", "language": "curl" }, { "code": "POST /email/1/send HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic bWt1dGljMjpNdTtpMjAxMiws\nAccept: application/json\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW\n\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"from\"\n\nJane Doe <jane.doe@somecompany.com>\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"to\"\n\njohn.smith@somecompany.com\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"subject\"\n\nTest mail subject\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"text\"\n\nSimple text body\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"html\"\n\n<h1>Html body</h1><p>Rich HTML message body.</p>\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"attachment\"; filename=\"image1.jpg\"\nContent-Type: application/x-object\n\n... contents of file goes here ...\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"attachment\"; filename=\"image2.jpg\"\nContent-Type: application/x-object\n\n... contents of file goes here ...\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", "language": "http" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"messages\": [\n {\n \"to\": \"john.smith@somecompany.com\",\n \"messageCount\": 1,\n \"messageId\": \"c268350e-c85e-41d1-b5a0-a60771b134bd\",\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 7,\n \"name\": \"PENDING_ENROUTE\",\n \"description\": \"Message sent to next instance\"\n }\n }\n ]\n}", "language": "json" } ] } [/block]