fix err
This commit is contained in:
@@ -226,6 +226,7 @@ describe('JMAPClient.sendEmail threading headers', () => {
|
|||||||
email: 'user@example.com',
|
email: 'user@example.com',
|
||||||
parameters: { HOLDFOR: expect.stringMatching(/^\d+$/) },
|
parameters: { HOLDFOR: expect.stringMatching(/^\d+$/) },
|
||||||
},
|
},
|
||||||
|
rcptTo: [{ email: 'recipient@example.com' }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+5
-3
@@ -2242,14 +2242,16 @@ export class JMAPClient implements IJMAPClient {
|
|||||||
const buildSubmissionCreate = (submissionId: string): Record<string, unknown> => {
|
const buildSubmissionCreate = (submissionId: string): Record<string, unknown> => {
|
||||||
const create: Record<string, unknown> = { emailId: `#${emailId}`, identityId: finalIdentityId };
|
const create: Record<string, unknown> = { emailId: `#${emailId}`, identityId: finalIdentityId };
|
||||||
if (holdForSeconds || envelopeMailFrom) {
|
if (holdForSeconds || envelopeMailFrom) {
|
||||||
|
const envelopeRecipients = [...to, ...(cc || []), ...(bcc || [])]
|
||||||
|
.map((email) => email.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((email) => ({ email }));
|
||||||
create.envelope = {
|
create.envelope = {
|
||||||
mailFrom: {
|
mailFrom: {
|
||||||
email: envelopeMailFrom || fromEmail || this.username,
|
email: envelopeMailFrom || fromEmail || this.username,
|
||||||
...(holdForSeconds ? { parameters: { HOLDFOR: String(holdForSeconds) } } : {}),
|
...(holdForSeconds ? { parameters: { HOLDFOR: String(holdForSeconds) } } : {}),
|
||||||
},
|
},
|
||||||
...(envelopeMailFrom
|
rcptTo: envelopeRecipients,
|
||||||
? { rcptTo: [...to, ...(cc || []), ...(bcc || [])].map((email) => ({ email })) }
|
|
||||||
: {}),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { [submissionId]: create };
|
return { [submissionId]: create };
|
||||||
|
|||||||
Reference in New Issue
Block a user