Ver V0.1.15 Remove initials icon from bottom left corner FIX Diplay name is supported per account
This commit is contained in:
+5
-3
@@ -110,10 +110,12 @@ function normalizeAccount(input) {
|
||||
const password = String(input?.password || '');
|
||||
const imapHost = String(input?.imapHost || '').trim();
|
||||
const smtpHost = String(input?.smtpHost || '').trim();
|
||||
const displayName = String(input?.displayName || '').trim().slice(0, 80);
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) || !password || !imapHost || !smtpHost) {
|
||||
throw new Error('Enter a valid email, password, and both mail server names.');
|
||||
}
|
||||
return { email, password, imapHost, smtpHost, imapPort: 143, smtpPort: 587 };
|
||||
if (!displayName) throw new Error('Enter a display name for this mail account.');
|
||||
return { email, password, displayName, imapHost, smtpHost, imapPort: 143, smtpPort: 587 };
|
||||
}
|
||||
|
||||
function imapClient(account) {
|
||||
@@ -183,7 +185,7 @@ async function readAccount(accountId = null) {
|
||||
}
|
||||
|
||||
function publicAccount(account) {
|
||||
return { id: account.id, email: account.email, imapHost: account.imapHost, smtpHost: account.smtpHost };
|
||||
return { id: account.id, email: account.email, displayName: account.displayName || '', imapHost: account.imapHost, smtpHost: account.smtpHost };
|
||||
}
|
||||
|
||||
async function saveAccount(account) {
|
||||
@@ -603,7 +605,7 @@ ipcMain.handle('mail:send', async (_event, message) => {
|
||||
if (!to) throw new Error('Add at least one recipient.');
|
||||
const transport = smtpTransport(account);
|
||||
const sentMessageId = `<${require('node:crypto').randomUUID()}@ep-mail.local>`;
|
||||
const fromName = String(message.displayName || account.email).replace(/[\r\n]+/g, ' ').trim().slice(0, 80) || account.email;
|
||||
const fromName = String(account.displayName || message.displayName || account.email).replace(/[\r\n]+/g, ' ').trim().slice(0, 80) || account.email;
|
||||
const messageOptions = {
|
||||
from: { name: fromName, address: account.email },
|
||||
to,
|
||||
|
||||
Reference in New Issue
Block a user