Skip to content

Commit

Permalink
Add ability to show bcc recipients if present, and not error on missi…
Browse files Browse the repository at this point in the history
…ng to recipient
  • Loading branch information
compwron committed Oct 2, 2024
1 parent 408d083 commit dd4ae5e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ async function createEmail(message) {
return {
timestamp: message.Timestamp,
subject: parsed.subject,
to: parsed.to.text,
to: parsed.to?.text,
cc: parsed.cc?.text,
bcc: parsed.bcc?.text,
html: parsed.html,
attachments: parsed.attachments,
isDownloadable: true,
Expand All @@ -117,6 +119,8 @@ async function createEmail(message) {
timestamp: message.Timestamp,
subject: message.Subject,
to: message.Destination.ToAddresses,
cc: message.Destination.CcAddresses,
bcc: message.Destination.BccAddresses,
html: message.Body.html_part ?? message.Body.text_part,
attachments: [],
isDownloadable: false,
Expand Down
13 changes: 13 additions & 0 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ describe("App Tests", () => {
html_part: null,
},
},
{
Timestamp: Date.now(),
Subject: "Test email CC and BCC only",
Destination: {
ToAddresses: [],
CcAddresses: ['[email protected]'],
BccAddresses: ['[email protected]']
},
Body: {
text_part: "This is a test email with only CC and BCC recipients",
html_part: null,
},
},
],
});
});
Expand Down
4 changes: 4 additions & 0 deletions views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ html
each column in extraColumns
th= column.name
th To
th CC
th BCC
th Subject
th
th
Expand All @@ -62,6 +64,8 @@ html
if logo
img(src=`data:image/png;base64,${logo.toString('base64')}`, height="24px", alt="Logo")
td= message.to
td= message.cc
td= message.bcc
td= message.subject
td
a(href='/emails/' + message.id) View
Expand Down

0 comments on commit dd4ae5e

Please sign in to comment.