Send an immediate email to your contacts
with or without parameters,
with or without attachments.
The sending can be done synchronously – this is the default mode.
Or asynchronously – in this case you will only get the “queued” response and sending will be done later with a background service.
POST /transactional/emails/send
*A parallel and almost identical method for sending and email with an HTML that is pre-save in inwise as a template:
POST /transactional/emails/sendTemplate )
Example 1 – Send attach file, using async mode
{ "message": { "html": "Hi", "subject": "This is the subject", "from_email": "newsletter@return-email.com", "reply_to": "replyToThis@yopmail.com", "from_name": "from rest test", "charset": "utf-8", "content_type": "html", "to": [ { "email": "EmailTest12@yopmail.com", "name": "John", "type": "to" } ] ,"attachments":[ { "type": "text/plain" ,"name":"testtxt.txt", "content": "this is the content of the text file" } ] } ,"async": true }
Example 2 – Basic sending, using async mode
{ "message": { "html": "html code", "text": "body string", "subject": "subject string", "from_email": "newsletter@return-email.com", "reply_to": "test@a.com", "from_name": "from me", "charset": "utf-8", "content_type": "html", "to": [ { "email": "ravitb@inwise.com", "name": "Ravit", "type": "to" } ], } , "async": true }
Example 3 – Send template, using tags and parameters, Using sync mode
{ "template_id":20052, "message": { "subject": "This is the title of the message", "from_email": "newsletter@return-email.com", "reply_to": "replyToThis@yopmail.com", "from_name": "from rest test", "charset": "utf-8", "content_type": "html", "to": [ { "email": "EmailTest12@yopmail.com", "name": "Rebecca", "type": "to" }, { "email": "EmailTest3@yopmail.com", "name": "Lily", "type": "to" } ] ,"field_vars": [ { "rcpt": "EmailTest12@yopmail.com", "fields": [ { "name": "#field1#", "content": "Rebecca" } ] } , { "rcpt": "EmailTest3@yopmail.com", "fields": [ { "name": "#field1#", "content": "Lily" } ] } ] ,"tags":["SendBill"] } }
Response code
200 | Success Request (without exception) |
400 | unknown exception
(in this case you can try again a few minutes later) |
423 | ResourceUseIsAccountLimited |
403 | Forbidden |
409 | Conflict |
402 | PaymentRequired |
404 | NotFound |
500 | InternalServerError
(in this case you can try again a few minutes later) |
422 | UnprocessableEntry
For example with response body: “Parameter value ‘message.from_email’ is not allowed.” |
429 | APICallWasRateLimited |
401 | Unauthorized |
Response body
The response is dependent on your request mode (synchronously sending versus asynchronously sending).
In Sync mode you will get the result immediately.
Mode (sync / Async) | Scenario | Status | Reject_reason | Transaction_id : is included |
Async | When the send request was successful, the email will be later sent from the queue. | queued | Not included | Yes, included |
Sync + Async | error in the email format | invalid | invalid-email | Not included |
Sync | was sent immediately with success | Sent | Not included | Yes, included |
Sync | The email is in the unsubscribe list | rejected | unsubscribe | Yes, included |
sync | The email is in the bounce list | rejected | bounced | Yes, included |
sync | No credit | rejected | insufficient-funds |
* There are more reject reasons as: exception, bounce, unsubscribed, no_credit, , cancelled_by_user
*When a sending is Queued or Sent, It is possible to get a later bounce result (because of a failure response from the destination server), That result will appear in the results methods / result webhook.
You can monitor the result of your Async send and Sync send:
- manually, in your inwise account, screen: Transactional Sent
- With webhook
- With these methods:
GET /transactional/emails/info
GET /transactional/emails/search