Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to show cc and bcc recipients if present, and not error on missing To recipient #39

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ async function createEmail(message) {
return {
timestamp: message.Timestamp,
subject: parsed.subject,
to: parsed.to.text,
to: parsed.to?.text,
denis90 marked this conversation as resolved.
Show resolved Hide resolved
cc: parsed.cc?.text,
bcc: parsed.bcc?.text,
html: parsed.html,
attachments: parsed.attachments,
isDownloadable: true,
Expand All @@ -136,6 +138,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
21 changes: 17 additions & 4 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,23 @@ describe("App Tests", () => {
},
Body: {
text_part: "This is a test email",
html_part: null
}
}
]
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