From e12402448c5b6bc22c9ca7f9bdb348c566b4018c Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Mon, 12 Nov 2018 13:31:03 +0200 Subject: [PATCH] allow uploading structured messages --- lib/api/messages.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/api/messages.js b/lib/api/messages.js index 16d5ea2e..83a3cc05 100644 --- a/lib/api/messages.js +++ b/lib/api/messages.js @@ -1849,13 +1849,12 @@ module.exports = (db, server, messageHandler) => { ); /** - * @api {post} /users/:user/mailboxes/:mailbox/messages Upload Message Source + * @api {post} /users/:user/mailboxes/:mailbox/messages Upload Message * @apiName UploadMessage * @apiGroup Messages - * @apiDescription This method allows to upload an RFC822 formatted message to a mailbox. Message + * @apiDescription This method allows to upload either an RFC822 formatted message or a message structure to a mailbox. Raw message * is stored unmodified, no headers are added or removed. If you want to generate the uploaded message - * from strucutred data fields, then see Submit a Message for Delivery - * with uploadOnly option + * from strucutred data fields, then do not use the raw property. * @apiHeader {String} X-Access-Token Optional access token if authentication is enabled * @apiHeaderExample {json} Header-Example: * { @@ -1909,6 +1908,14 @@ module.exports = (db, server, messageHandler) => { * Subject: hello world! * * Example message' + * @apiExample {curl} Upload a Message Structure: + * curl -i -XPOST "http://localhost:8080/users/5a2f9ca57308fc3a6f5f811d/mailboxes/5a2f9ca57308fc3a6f5f811e/messages" \ + * -H 'Content-type: message/rfc822' \ + * -d 'From: sender@example.com + * To: recipient@example.com + * Subject: hello world! + * + * Example message' * * @apiSuccessExample {json} Forward Response: * HTTP/1.1 200 OK