Email improvements.

Ylian Saint-Hilaire committed Dec 17, 2020 at 14:50 UTC b200d48f56e18ba8a1dd8e05c127bee7466fa8d2
18 files changed +65 -38
emails/mesh-invite.html
+2 -2
@@ -12,7 +12,7 @@
12 Hello [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>User [[[USERNAME]]] on server <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting you to install software to start a remote control session.</p>
15 + <p>User [[[USERNAME]]] on server <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> is requesting you to install software to start a remote control session.</p>
16 <area-msg>
17 <p>
18 Message: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - To install the software, <a href="[[[SERVERURL]]][[[LINKURL]]]">click here</a> and follow the instructions.
37 + To install the software, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">click here</a> and follow the instructions.
38 </p>
39 </area-link>
40 <p>If you did not initiate this request, please ignore this mail.</p>
emails/translations/mesh-invite_cs.html
+2 -2
@@ -12,7 +12,7 @@
12 Dobrý den, [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Uživatel [[[USERNAME]]] na serveru <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> vás žádá o instalaci softwaru pro spuštění relace dálkového ovládání.</p>
15 + <p>Uživatel [[[USERNAME]]] na serveru <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> vás žádá o instalaci softwaru pro spuštění relace dálkového ovládání.</p>
16 <area-msg>
17 <p>
18 Zpráva: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Chcete-li nainstalovat software, <a href="[[[SERVERURL]]][[[LINKURL]]]">klikněte zde</a> a postupujte podle pokynů.
37 + Chcete-li nainstalovat software, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">klikněte zde</a> a postupujte podle pokynů.
38 </p>
39 </area-link>
40 <p>Pokud jste tento požadavek nezačali, ignorujte tento e-mail.</p>
emails/translations/mesh-invite_de.html
+2 -2
@@ -12,7 +12,7 @@
12 Hallo [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Benutzer [[[USERNAME]]] auf dem Server <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> fordert Sie auf, Software zu installieren, um eine Fernsteuerungssitzung zu starten.</p>
15 + <p>Benutzer [[[USERNAME]]] auf dem Server <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> fordert Sie auf, Software zu installieren, um eine Fernsteuerungssitzung zu starten.</p>
16 <area-msg>
17 <p>
18 Botschaft: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Um die Software zu installieren, <a href="[[[SERVERURL]]][[[LINKURL]]]">hier klicken</a> und folgen Sie den Anweisungen.
37 + Um die Software zu installieren, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">hier klicken</a> und folgen Sie den Anweisungen.
38 </p>
39 </area-link>
40 <p>Wenn Sie diese Anfrage nicht initiiert haben, ignorieren Sie diese Mail bitte.</p>
emails/translations/mesh-invite_es.html
+2 -2
@@ -12,7 +12,7 @@
12 Hola [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Usuario [[[USERNAME]]] en servidor <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> le solicita que instale software para iniciar una sesión de control remoto.</p>
15 + <p>Usuario [[[USERNAME]]] en servidor <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> le solicita que instale software para iniciar una sesión de control remoto.</p>
16 <area-msg>
17 <p>
18 Mensaje: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Para instalar el software, <a href="[[[SERVERURL]]][[[LINKURL]]]">haga clic aquí</a> y siga las instrucciones.
37 + Para instalar el software, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">haga clic aquí</a> y siga las instrucciones.
38 </p>
39 </area-link>
40 <p>Si Ud. no inicio este requerimiento, por favor ignore este correo.</p>
emails/translations/mesh-invite_fi.html
+2 -2
@@ -12,7 +12,7 @@
12 Hei [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Käyttäjä [[[USERNAME]]] palvelimella <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> pyytää sinua asentamaan ohjelmiston etäohjausistunnon aloittamiseksi.</p>
15 + <p>Käyttäjä [[[USERNAME]]] palvelimella <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> pyytää sinua asentamaan ohjelmiston etäohjausistunnon aloittamiseksi.</p>
16 <area-msg>
17 <p>
18 Viesti: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Asentaaksesi ohjelman, <a href="[[[SERVERURL]]][[[LINKURL]]]">klikkaa tästä</a> ja seuraa ohjeita.
37 + Asentaaksesi ohjelman, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">klikkaa tästä</a> ja seuraa ohjeita.
38 </p>
39 </area-link>
40 <p>Jos et suorittanut tätä pyyntöä, voit ohitaa tämän sähköpostin.</p>
emails/translations/mesh-invite_fr.html
+2 -2
@@ -12,7 +12,7 @@
12 Bonjour [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Utilisateur [[[USERNAME]]] sur le serveur <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> vous demande d'installer un logiciel pour démarrer une session de contrôle à distance.</p>
15 + <p>Utilisateur [[[USERNAME]]] sur le serveur <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> vous demande d'installer un logiciel pour démarrer une session de contrôle à distance.</p>
16 <area-msg>
17 <p>
18 Message: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Pour installer le logiciel, <a href="[[[SERVERURL]]][[[LINKURL]]]">cliquez ici</a> et suivez les instructions.
37 + Pour installer le logiciel, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">cliquez ici</a> et suivez les instructions.
38 </p>
39 </area-link>
40 <p>Si vous n'avez pas initié cette demande, veuillez ignorer ce courrier.</p>
emails/translations/mesh-invite_hi.html
+2 -2
@@ -12,7 +12,7 @@
12 नमस्कार [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>उपयोगकर्ता [[[USERNAME]]] सर्वर पर <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> रिमोट कंट्रोल सेशन शुरू करने के लिए आपको सॉफ्टवेयर इंस्टॉल करने का अनुरोध कर रहा है।</p>
15 + <p>उपयोगकर्ता [[[USERNAME]]] सर्वर पर <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> रिमोट कंट्रोल सेशन शुरू करने के लिए आपको सॉफ्टवेयर इंस्टॉल करने का अनुरोध कर रहा है।</p>
16 <area-msg>
17 <p>
18 संदेश: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - सॉफ़्टवेयर स्थापित करने के लिए, <a href="[[[SERVERURL]]][[[LINKURL]]]">यहाँ क्लिक करें</a> और निर्देशों का पालन करें।
37 + सॉफ़्टवेयर स्थापित करने के लिए, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">यहाँ क्लिक करें</a> और निर्देशों का पालन करें।
38 </p>
39 </area-link>
40 <p>यदि आपने यह अनुरोध आरंभ नहीं किया है, तो कृपया इस मेल को अनदेखा करें।</p>
emails/translations/mesh-invite_ja.html
+2 -2
@@ -12,7 +12,7 @@
12 [[[NAME]]]様
13 </p>
14 </area-name>
15 - <p>サーバー上のユーザー[[[USERNAME]]] <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> リモートコントロールセッションを開始するソフトウェアをインストールするように要求しています。</p>
15 + <p>サーバー上のユーザー[[[USERNAME]]] <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> リモートコントロールセッションを開始するソフトウェアをインストールするように要求しています。</p>
16 <area-msg>
17 <p>
18 メッセージ: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - ソフトウェアをインストールするには、 <a href="[[[SERVERURL]]][[[LINKURL]]]">ここをクリック</a> 指示に従ってください。
37 + ソフトウェアをインストールするには、 <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">ここをクリック</a> 指示に従ってください。
38 </p>
39 </area-link>
40 <p>このリクエストを開始していない場合は、このメールを無視してください。</p>
emails/translations/mesh-invite_ko.html
+2 -2
@@ -12,7 +12,7 @@
12 안녕하세요, [[[NAME]]]님.
13 </p>
14 </area-name>
15 - <p>서버의 [[[USERNAME]]] 사용자 <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> 원격 제어 세션을 시작하기 위해 소프트웨어 설치를 요청하고 있습니다.</p>
15 + <p>서버의 [[[USERNAME]]] 사용자 <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> 원격 제어 세션을 시작하기 위해 소프트웨어 설치를 요청하고 있습니다.</p>
16 <area-msg>
17 <p>
18 메시지: <b notrans="1">[[[MSG]]]</b>
@@ -35,7 +35,7 @@
35 </area-linux>
36 <area-link>
37 <p>
38 - 소프트웨어를 설치하려면, <a href="[[[SERVERURL]]][[[LINKURL]]]">여기를 클릭하십시오.</a> 그리고 다음 지시들을 따르십시오.
38 + 소프트웨어를 설치하려면, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">여기를 클릭하십시오.</a> 그리고 다음 지시들을 따르십시오.
39 </p>
40 </area-link>
41 <p>이 요청을 시작하지 않은 경우, 이 메일을 무시하십시오.</p>
emails/translations/mesh-invite_nl.html
+2 -2
@@ -12,7 +12,7 @@
12 Hallo [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Gebruiker [[[USERNAME]]] op server <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> vraagt u om de software te installeren om een ondersteunings sessie te starten.</p>
15 + <p>Gebruiker [[[USERNAME]]] op server <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> vraagt u om de software te installeren om een ondersteunings sessie te starten.</p>
16 <area-msg>
17 <p>
18 Bericht: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Om de software te installeren, <a href="[[[SERVERURL]]][[[LINKURL]]]">Klik hier</a> en volg de instructies.
37 + Om de software te installeren, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">Klik hier</a> en volg de instructies.
38 </p>
39 </area-link>
40 <p>Als u dit verzoek niet heeft ingediend, dan kunt u deze e-mail negeren.</p>
emails/translations/mesh-invite_pt.html
+2 -2
@@ -12,7 +12,7 @@
12 Olá [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Usuário [[[USERNAME]]] no servidor <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> está solicitando a instalação de um software para iniciar uma sessão de controle remoto.</p>
15 + <p>Usuário [[[USERNAME]]] no servidor <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> está solicitando a instalação de um software para iniciar uma sessão de controle remoto.</p>
16 <area-msg>
17 <p>
18 Mensagem: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Para instalar o software, <a href="[[[SERVERURL]]][[[LINKURL]]]">Clique aqui</a> e siga as instruções.
37 + Para instalar o software, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">Clique aqui</a> e siga as instruções.
38 </p>
39 </area-link>
40 <p>Se você não iniciou esta solicitação, ignore este e-mail.</p>
emails/translations/mesh-invite_ru.html
+2 -2
@@ -12,7 +12,7 @@
12 Здравствуйте, [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Пользователь [[[USERNAME]]] на сервере <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> просит вас установить программное обеспечение, чтобы начать сеанс удаленного управления.</p>
15 + <p>Пользователь [[[USERNAME]]] на сервере <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> просит вас установить программное обеспечение, чтобы начать сеанс удаленного управления.</p>
16 <area-msg>
17 <p>
18 Сообщение: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Чтобы установить программное обеспечение, <a href="[[[SERVERURL]]][[[LINKURL]]]">кликните сюда</a> и следуйте инструкциям.
37 + Чтобы установить программное обеспечение, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">кликните сюда</a> и следуйте инструкциям.
38 </p>
39 </area-link>
40 <p>Если вы не инициировали этот запрос, игнорируйте это письмо.</p>
emails/translations/mesh-invite_tr.html
+2 -2
@@ -12,7 +12,7 @@
12 Merhaba [[[NAME]]],
13 </p>
14 </area-name>
15 - <p>Sunucudaki kullanıcı [[[USERNAME]]] <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> bir uzaktan kontrol oturumu başlatmak için yazılım yüklemenizi istiyor.</p>
15 + <p>Sunucudaki kullanıcı [[[USERNAME]]] <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> bir uzaktan kontrol oturumu başlatmak için yazılım yüklemenizi istiyor.</p>
16 <area-msg>
17 <p>
18 İleti: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - Yazılımı kurmak için, <a href="[[[SERVERURL]]][[[LINKURL]]]">buraya Tıkla</a> ve talimatları izleyin.
37 + Yazılımı kurmak için, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">buraya Tıkla</a> ve talimatları izleyin.
38 </p>
39 </area-link>
40 <p>Bu isteği siz başlatmadıysanız, lütfen bu postayı dikkate almayın.</p>
emails/translations/mesh-invite_zh-chs.html
+2 -2
@@ -12,7 +12,7 @@
12 您好[[[NAME]]],
13 </p>
14 </area-name>
15 - <p>服务器上的使用者[[[USERNAME]]] <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> 正在要求您安装软件以启动远程控制会话。</p>
15 + <p>服务器上的使用者[[[USERNAME]]] <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]]</a> 正在要求您安装软件以启动远程控制会话。</p>
16 <area-msg>
17 <p>
18 消息: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - 要安装软件, <a href="[[[SERVERURL]]][[[LINKURL]]]">点击这里</a> 并按照说明进行操作。
37 + 要安装软件, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">点击这里</a> 并按照说明进行操作。
38 </p>
39 </area-link>
40 <p>如果您没有发起此请求,请不理此邮件。</p>
emails/translations/mesh-invite_zh-cht.html
+2 -2
@@ -12,7 +12,7 @@
12 你好[[[NAME]]],
13 </p>
14 </area-name>
15 - <p>伺服器上的使用者[[[USERNAME]]] <a href="[[[SERVERURL]]]">[[[SERVERNAME]]</a> 正在要求你安裝軟體以啟動遠程控制會話。</p>
15 + <p>伺服器上的使用者[[[USERNAME]]] <a href="[[[SERVERURL]]][[[URLARGS1]]]">[[[SERVERNAME]]</a> 正在要求你安裝軟體以啟動遠程控制會話。</p>
16 <area-msg>
17 <p>
18 訊息: <b notrans="1">[[[MSG]]]</b>
@@ -34,7 +34,7 @@
34 </area-linux>
35 <area-link>
36 <p>
37 - 要安裝軟體, <a href="[[[SERVERURL]]][[[LINKURL]]]">點擊這裡</a> 並按照說明進行操作。
37 + 要安裝軟體, <a href="[[[SERVERURL]]][[[LINKURL]]][[[URLARGS2]]]">點擊這裡</a> 並按照說明進行操作。
38 </p>
39 </area-link>
40 <p>如果你沒有發起此請求,請不理此電郵。</p>
meshcentral-config-schema.json
+2 -1
@@ -551,7 +551,8 @@
551 "type": "object",
552 "properties": {
553 "from": { "type": "string", "format": "email", "description": "Email address used in the messages from field." },
554 - "apikey": { "type": "string", "description": "The SendGrid API key." }
554 + "apikey": { "type": "string", "description": "The SendGrid API key." },
555 + "verifyemail": { "type": "boolean", "default": true, "description": "When set to false, the email format and DNS MX record are not checked." }
556 },
557 "required": [ "from", "apikey" ]
558 },
meshmail.js
+32 -6
@@ -178,8 +178,13 @@ module.exports.CreateMeshMail = function (parent) {
178 var options = { email: email, servername: domain.title ? domain.title : 'MeshCentral', token: token };
179 if (loginkey != null) { options.urlargs1 = '?key=' + loginkey; options.urlargs2 = '&key=' + loginkey; } else { options.urlargs1 = ''; options.urlargs2 = ''; }
180
181 + // Get from field
182 + var from = null;
183 + if (parent.config.sendgrid && (typeof parent.config.sendgrid.from == 'string')) { from = parent.config.sendgrid.from; }
184 + else if (parent.config.smtp && (typeof parent.config.smtp.from == 'string')) { from = parent.config.smtp.from; }
185 +
186 // Send the email
182 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
187 + obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
188 sendNextMail();
189 }
190 });
@@ -206,8 +211,13 @@ module.exports.CreateMeshMail = function (parent) {
211 var options = { username: username, accountname: accountname, email: email, servername: domain.title ? domain.title : 'MeshCentral', password: password };
212 if (loginkey != null) { options.urlargs1 = '?key=' + loginkey; options.urlargs2 = '&key=' + loginkey; } else { options.urlargs1 = ''; options.urlargs2 = ''; }
213
214 + // Get from field
215 + var from = null;
216 + if (parent.config.sendgrid && (typeof parent.config.sendgrid.from == 'string')) { from = parent.config.sendgrid.from; }
217 + else if (parent.config.smtp && (typeof parent.config.smtp.from == 'string')) { from = parent.config.smtp.from; }
218 +
219 // Send the email
210 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
220 + obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
221 sendNextMail();
222 }
223 });
@@ -235,8 +245,13 @@ module.exports.CreateMeshMail = function (parent) {
245 if (loginkey != null) { options.urlargs1 = '?key=' + loginkey; options.urlargs2 = '&key=' + loginkey; } else { options.urlargs1 = ''; options.urlargs2 = ''; }
246 options.cookie = obj.parent.encodeCookie({ u: userid, e: email, a: 1 }, obj.mailCookieEncryptionKey);
247
248 + // Get from field
249 + var from = null;
250 + if (parent.config.sendgrid && (typeof parent.config.sendgrid.from == 'string')) { from = parent.config.sendgrid.from; }
251 + else if (parent.config.smtp && (typeof parent.config.smtp.from == 'string')) { from = parent.config.smtp.from; }
252 +
253 // Send the email
239 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
254 + obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
255 sendNextMail();
256 }
257 });
@@ -264,8 +279,13 @@ module.exports.CreateMeshMail = function (parent) {
279 if (loginkey != null) { options.urlargs1 = '?key=' + loginkey; options.urlargs2 = '&key=' + loginkey; } else { options.urlargs1 = ''; options.urlargs2 = ''; }
280 options.cookie = obj.parent.encodeCookie({ u: userid, e: email, a: 2 }, obj.mailCookieEncryptionKey);
281
282 + // Get from field
283 + var from = null;
284 + if (parent.config.sendgrid && (typeof parent.config.sendgrid.from == 'string')) { from = parent.config.sendgrid.from; }
285 + else if (parent.config.smtp && (typeof parent.config.smtp.from == 'string')) { from = parent.config.smtp.from; }
286 +
287 // Send the email
268 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
288 + obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
289 sendNextMail();
290 }
291 });
@@ -297,8 +317,13 @@ module.exports.CreateMeshMail = function (parent) {
317 options.link = (os == 4) ? 1 : 0;
318 options.linkurl = createInviteLink(domain, meshid, flags, expirehours);
319
320 + // Get from field
321 + var from = null;
322 + if (parent.config.sendgrid && (typeof parent.config.sendgrid.from == 'string')) { from = parent.config.sendgrid.from; }
323 + else if (parent.config.smtp && (typeof parent.config.smtp.from == 'string')) { from = parent.config.smtp.from; }
324 +
325 // Send the email
301 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
326 + obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
327 sendNextMail();
328 }
329 });
@@ -388,7 +413,8 @@ module.exports.CreateMeshMail = function (parent) {
413 // Check the email domain DNS MX record.
414 obj.approvedEmailDomains = {};
415 obj.checkEmail = function (email, func) {
391 - if (parent.config.smtp.verifyemail === false) { func(true); return; }
416 + if ((parent.config.smtp) && (parent.config.smtp.verifyemail === false)) { func(true); return; }
417 + if ((parent.config.sendgrid) && (parent.config.sendgrid.verifyemail === false)) { func(true); return; }
418 var emailSplit = email.split('@');
419 if (emailSplit.length != 2) { func(false); return; }
420 if (obj.approvedEmailDomains[emailSplit[1]] === true) { func(true); return; }
meshuser.js
+1 -1
@@ -4065,7 +4065,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
4065 }
4066
4067 // Perform email invitation
4068 - parent.parent.mailserver.sendAgentInviteMail(domain, (user.realname ? user.realname : user.name), command.email.toLowerCase(), command.meshid, command.name, command.os, command.msg, command.flags, command.expire, parent.getLanguageCodes(req));
4068 + parent.parent.mailserver.sendAgentInviteMail(domain, (user.realname ? user.realname : user.name), command.email.toLowerCase(), command.meshid, command.name, command.os, command.msg, command.flags, command.expire, parent.getLanguageCodes(req), req.query.key);
4069
4070 // Send a response if needed
4071 if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'inviteAgent', responseid: command.responseid, result: 'ok' })); } catch (ex) { } }