Skip to content

Commit 04a1b59

Browse files
committed
fix git divergence issues: submit.js
1 parent dd60577 commit 04a1b59

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

Diff for: lib/api/submit.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Transform = require('stream').Transform;
1515
const { sessSchema, sessIPSchema, booleanSchema, metaDataSchema } = require('../schemas');
1616
const { preprocessAttachments } = require('../data-url');
1717
const { userId, mailboxId } = require('../schemas/request/general-schemas');
18-
const { AddressOptionalName, AddressOptionalNameArray, Header, Attachment, ReferenceWithAttachments } = require('../schemas/request/messages-schemas');
18+
const { AddressOptionalName, AddressOptionalNameArray, Header, ReferenceWithoutAttachments } = require('../schemas/request/messages-schemas');
1919
const { successRes } = require('../schemas/response/general-schemas');
2020

2121
class StreamCollect extends Transform {
@@ -631,7 +631,7 @@ module.exports = (db, server, messageHandler, userHandler, settingsHandler) => {
631631
description: 'Use this method to send emails from a user account',
632632
validationObjs: {
633633
requestBody: {
634-
mailbox: mailboxId,
634+
mailbox: Joi.string().hex().lowercase().length(24).description('ID of the Mailbox'),
635635
from: AddressOptionalName.description('Addres for the From: header'),
636636
replyTo: AddressOptionalName.description('Address for the Reply-To: header'),
637637
to: Joi.array()
@@ -664,12 +664,27 @@ module.exports = (db, server, messageHandler, userHandler, settingsHandler) => {
664664
.empty('')
665665
.max(1024 * 1024)
666666
.description('HTML formatted message'),
667-
attachments: Joi.array().items(Attachment).description('Attachments for the message'),
667+
attachments: Joi.array()
668+
.items(
669+
Joi.object({
670+
filename: Joi.string().empty('').max(255).description('Attachment filename'),
671+
contentType: Joi.string().empty('').max(255).description('MIME type for the attachment file'),
672+
encoding: Joi.string().empty('').default('base64').description('Encoding to use to store the attachments'),
673+
contentTransferEncoding: Joi.string().empty('').description('Transfer encoding'),
674+
contentDisposition: Joi.string().empty('').trim().lowercase().valid('inline', 'attachment').description('Content Disposition'),
675+
content: Joi.string().required().description('Base64 encoded attachment content'),
676+
cid: Joi.string()
677+
.empty('')
678+
.max(255)
679+
.description('Content-ID value if you want to reference to this attachment from HTML formatted message')
680+
})
681+
)
682+
.description('Attachments for the message'),
668683

669684
meta: metaDataSchema.label('metaData').description('Optional metadata, must be an object or JSON formatted string'),
670685
sess: sessSchema,
671686
ip: sessIPSchema,
672-
reference: ReferenceWithAttachments.description(
687+
reference: ReferenceWithoutAttachments.description(
673688
'Optional referenced email. If uploaded message is a reply draft and relevant fields are not provided then these are resolved from the message to be replied to'
674689
),
675690
// if true then treat this message as a draft

0 commit comments

Comments
 (0)