Mail

From Ocean Framework Documentation Wiki
Jump to: navigation, search

The Email service has one public URL. (For information about the difference between Public and Internal URLs and HATEOAS conventions, please see API Structure and Conventions.)

/v1/mails

POST /v1/mails

Sends an email. The email will always contain both an HTML and a plaintext version.

The body of the POST can contain the following attributes:

from
(String) The email address of the sender. Defaults to "Noreply <noreply@example.com>".
to
(String) The email address of the recipient. Must be specified.
subject
(String) The subject of the email. Must be specified.
plaintext
(String) The plain text version of the message. If not given, a plaintext version of the html attribute will be used.
html
(String) The HTML version of the message. If not given, the plaintext attribute will be treated as Markdown and translated into HTML.
plaintext_url
(String) If present, a URI of a Text resource to be used for the plaintext version of the message.
html_url
(String) If present, a URI of a Text resource to be used for the HTML version of the message.
substitutions
(Object) If present, a hash table of text substitutions to be performed on both plaintext and HTML versions.

An AsyncJob is returned. In most cases you will probably just ignore it, but it is possible to perform CRUD operations on it to delete it and/or poll it for changes.

Return codes

202
An AsyncJob has been created and queued to send the email, which may or may not have been dispatched when the response is received by the service consumer. The AsyncJob resource is returned in the body and can be used to determine the current status of the job.