Skip to content

Commit

Permalink
fix incorrect json info and simplify the curl a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ruffrey committed Jun 25, 2020
1 parent 558cbef commit cc3f7e3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions getting_started/sendmail.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ endpoint is accessed with :code:`POST /api/outgoing-messages`. This API uses a P
two examples, which use GET. Several pieces of information are required to send an email.

* Mailsac API Key
* To address
* From address
* Text
* :code:`to` address
* :code:`from` address
* :code:`text` message text body

Since emails without subjects frequently get marked as spam, we are also going to include a subject in our email. Our email
message will be transmitted in JSON, therefore we have to set the content type to ::code:`Content-Type: application/json`.
Our message data will be a comma separated key value array.
message will be transmitted in JSON, therefore we must set the content type to ::code:`Content-Type: application/json`.
Our message data will be a JSON object. Mailsac also supports sending raw
SMTP text through this REST API - see the REST API specification for more info.

.. code-block:: bash
:caption: **Send an email**
curl --header "Content-Type: application/json" --request POST \
--data '{"_mailsacKey": "eoj1mn7x5y61w0egs25j6xrvs6lwrrld0oh43rj583cgdps10tokp2ceux9s6ri8eoj1mn7x5y6", \
"to": "recipient@gmail.com", "subject": "This is a test", "from": "sender@mailsac.com", \
"text": "This is a test"}' https://mailsac.com/api/outgoing-messages
curl -H "Content-Type: application/json" \
-H "Mailsac-Key: eoj1mn7x5y61w0egs25j6xrvs6lwrrl"
-X POST \
--data '{"to": "recipient@mailsac.com.com", "subject": "This is a test", "from": "my_sender@mailsac.com", "text": "This is a test"}' \
https://mailsac.com/api/outgoing-messages

0 comments on commit cc3f7e3

Please sign in to comment.