diff --git a/src/components/Composer.vue b/src/components/Composer.vue
index 1472b84d90..c2ecfe4bfe 100644
--- a/src/components/Composer.vue
+++ b/src/components/Composer.vue
@@ -165,49 +165,119 @@
{{ t('mail', 'Draft saved') }}
-
- {{
- t('mail', 'Upload attachment')
- }}
-
-
- {{
- t('mail', 'Add attachment from Files')
- }}
-
-
- {{
- addShareLink
- }}
-
-
- {{ t('mail', 'Enable formatting') }}
-
-
- {{ t('mail', 'Request a read receipt') }}
-
-
- {{ t('mail', 'Encrypt message with Mailvelope') }}
-
-
- {{
- t('mail', 'Looking for a way to encrypt your emails? Install the Mailvelope browser extension!')
- }}
-
+
+
+ {{
+ t('mail', 'Upload attachment')
+ }}
+
+
+ {{
+ t('mail', 'Add attachment from Files')
+ }}
+
+
+ {{
+ addShareLink
+ }}
+
+
+
+
+
+ {{
+ t('mail', 'Send later')
+ }}
+
+
+ {{ t('mail', 'Enable formatting') }}
+
+
+ {{ t('mail', 'Request a read receipt') }}
+
+
+ {{ t('mail', 'Encrypt message with Mailvelope') }}
+
+
+ {{
+ t('mail', 'Looking for a way to encrypt your emails? Install the Mailvelope browser extension!')
+ }}
+
+
+
+
+
+
+ {{ t('mail', 'Send later') }}
+
+
+
+ {{ t('mail', 'Send now') }}
+
+
+ {{ t('mail', 'Tomorrow morning') }} - {{ convertToLocalDate(dateTomorrowMorning) }}
+
+
+ {{ t('mail', 'Tomorrow afternoon') }} - {{ convertToLocalDate(dateTomorrowAfternoon) }}
+
+
+ {{ t('mail', 'Monday morning') }} - {{ convertToLocalDate(dateMondayMorning) }}
+
+
+ {{ t('mail', 'Custom') }}
+
+
+ {{ t('mail', 'Enter a date') }}
+
+
@@ -979,4 +1125,7 @@ export default {
margin-top: 250px;
height: 120px;
}
+.send-action-radio {
+ padding: 5px 0 5px 0;
+}
diff --git a/src/components/NewMessageModal.vue b/src/components/NewMessageModal.vue
index 7e0dc9a91e..59c6656565 100644
--- a/src/components/NewMessageModal.vue
+++ b/src/components/NewMessageModal.vue
@@ -97,47 +97,41 @@ export default {
},
async sendMessage(data) {
logger.debug('sending message', { data })
+ const now = new Date().getTime()
+ const dataForServer = {
+ accountId: data.account,
+ subject: data.subject,
+ body: data.isHtml ? data.body.value : toPlain(data.body).value,
+ isHtml: data.isHtml,
+ to: data.to,
+ cc: data.cc,
+ bcc: data.bcc,
+ attachments: data.attachments,
+ aliasId: null,
+ inReplyToMessageId: null,
+ sendAt: data.sendAt ?? Math.floor(now / 1000),
+ }
+ if (dataForServer.sendAt < now) {
+ dataForServer.sendAt = now
+ }
if (this.composerMessage.type === 'outbox') {
- const now = new Date().getTime()
- const dataForServer = {
- accountId: data.account,
- subject: data.subject,
- body: data.isHtml ? data.body.value : toPlain(data.body).value,
- isHtml: data.isHtml,
- to: data.to,
- cc: data.cc,
- bcc: data.bcc,
- attachments: data.attachments,
- aliasId: data.aliasId,
- inReplyToMessageId: null,
- sendAt: Math.floor(now / 1000), // JS timestamp is in milliseconds
- }
- const message = await this.$store.dispatch('outbox/updateMessage', {
+ // TODO: update the message instead of enqueing another time
+ const message = await this.$store.dispatch('outbox/enqueueMessage', {
message: dataForServer,
id: this.composerData.id,
})
+ if (!data.sendAt) {
+ await this.$store.dispatch('outbox/sendMessage', { id: message.id })
+ }
- await this.$store.dispatch('outbox/sendMessage', { id: message.id })
} else {
- const now = new Date().getTime()
- const dataForServer = {
- accountId: data.account,
- subject: data.subject,
- body: data.isHtml ? data.body.value : toPlain(data.body).value,
- isHtml: data.isHtml,
- to: data.to,
- cc: data.cc,
- bcc: data.bcc,
- attachments: data.attachments,
- aliasId: data.aliasId,
- inReplyToMessageId: null,
- sendAt: Math.floor(now / 1000), // JS timestamp is in milliseconds
- }
const message = await this.$store.dispatch('outbox/enqueueMessage', {
message: dataForServer,
})
- await this.$store.dispatch('outbox/sendMessage', { id: message.id })
+ if (!data.sendAt) {
+ await this.$store.dispatch('outbox/sendMessage', { id: message.id })
+ }
if (data.draftId) {
// Remove old draft envelope