From 73dd4677da616eef1d746d4306bd4814ada81afe Mon Sep 17 00:00:00 2001 From: Mohammad Rezaei Date: Mon, 16 Oct 2023 15:41:28 +0330 Subject: [PATCH] Sending group email to all contact addresses --- dev/Model/Contact.js | 22 +++++++++++++++++++ dev/Styles/User/Contacts.less | 7 +++++- dev/View/Popup/Compose.js | 8 ++++++- .../v/0.0.0/app/localization/en/user.json | 3 ++- .../templates/Views/User/PopupsContacts.html | 5 +++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/dev/Model/Contact.js b/dev/Model/Contact.js index 0be41a66b..e3d34bae7 100644 --- a/dev/Model/Contact.js +++ b/dev/Model/Contact.js @@ -86,6 +86,7 @@ export class ContactModel extends AbstractModel { focused: false, selected: false, checked: false, + sendToAll: true, deleted: false, readOnly: false, @@ -139,7 +140,16 @@ export class ContactModel extends AbstractModel { */ getNameAndEmailHelper() { let name = (this.givenName() + ' ' + this.surName()).trim(), + email; + + if (this.sendToAll()) { + email = []; + this.email().forEach(function (key){ + email.push(key?.value()) + }); + } else { email = this.email()[0]?.value(); + } /* // this.jCard.getOne('fn')?.notEmpty() || this.jCard.parseFullName({set:true}); @@ -222,6 +232,9 @@ export class ContactModel extends AbstractModel { value: ko.observable('') // type: prop.params.type }); + + if (this.sendToAllDisplayStatus()) + document.getElementById('send-to-all').style.display = 'block'; } addTel() { @@ -318,4 +331,13 @@ export class ContactModel extends AbstractModel { + (this.checked() ? ' checked' : '') + (this.focused() ? ' focused' : ''); } + + sendToAllDefaultValue() { + return (this.sendToAll() ? ' checked' : ''); + } + + sendToAllDisplayStatus() { + return this.email.length > 1 + } + } diff --git a/dev/Styles/User/Contacts.less b/dev/Styles/User/Contacts.less index a7f57ccfe..401248ec2 100644 --- a/dev/Styles/User/Contacts.less +++ b/dev/Styles/User/Contacts.less @@ -166,10 +166,15 @@ margin-bottom: 5px; } - input, textarea { + input[type='text'], textarea { width: 70vw; max-width: 400px; } + + #send-to-all > input[type="checkbox"] { + margin-left: 2px; + margin-right: 10px; + } } .read-only-sign { diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index e1557d268..946a1d68a 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -1381,6 +1381,12 @@ export class ComposePopupView extends AbstractViewPopup { } }); + let sToAddress = this.to(); + + if (/".*" <.*,.*>/g.test(sToAddress)) { + sToAddress = sToAddress.match(/<.*>/g)[0].replace(/[<>]/g, ''); + } + const identity = this.currentIdentity(), params = { @@ -1389,7 +1395,7 @@ export class ComposePopupView extends AbstractViewPopup { messageUid: this.draftUid(), saveFolder: sSaveFolder, from: this.from(), - to: this.to(), + to: sToAddress, cc: this.cc(), bcc: this.bcc(), replyTo: this.replyTo(), diff --git a/snappymail/v/0.0.0/app/localization/en/user.json b/snappymail/v/0.0.0/app/localization/en/user.json index b444b2dbc..cd5cbbd45 100644 --- a/snappymail/v/0.0.0/app/localization/en/user.json +++ b/snappymail/v/0.0.0/app/localization/en/user.json @@ -209,7 +209,8 @@ "ADD_MENU_BIRTHDAY": "Birthday", "ADD_MENU_TAGS": "Tags", "BUTTON_SHARE_ALL": "Everyone", - "BUTTON_SYNC": "Synchronization (CardDAV)" + "BUTTON_SYNC": "Synchronization (CardDAV)", + "SEND_TO_ALL_CONTACT_EMAILS": "Send to all contact emails" }, "COMPOSE": { "LINK_SHOW_INPUTS": "show all fields", diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsContacts.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsContacts.html index 6a0a5bc32..cb940c213 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsContacts.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsContacts.html @@ -134,6 +134,11 @@
+
+ + +
+