fix: parse multi-recipient addresses in getSentMail stored copy#288
Closed
moltboie wants to merge 4 commits intohoiekim:mainfrom
Closed
fix: parse multi-recipient addresses in getSentMail stored copy#288moltboie wants to merge 4 commits intohoiekim:mainfrom
moltboie wants to merge 4 commits intohoiekim:mainfrom
Conversation
Contributor
Author
Self-ReviewDiscussion thread status:
Checked:
E2E Testing:
Issues found:
Confidence: High |
Replace synchronous writeFileSync wrapped in Promise constructor with truly async fs.promises.writeFile. Also: - Use mkdirSync with recursive:true to remove TOCTOU race on dir creation - Remove unnecessary 'as unknown as Uint8Array' type cast Closes hoiekim#283
When sending to multiple recipients, getSentMail() was wrapping the
entire comma-separated string as a single address entry. Split by
comma and trim each address before storing.
Adds parseRecipientAddresses() helper used for to/cc/bcc value arrays
and envelopeTo. The existing addressParser export uses { email } format
for Mailgun sending; this new helper uses { address } for Mail storage.
Closes hoiekim#287
c6c5ce1 to
1319d13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When sending an email to multiple recipients (e.g.,
alice@example.com, bob@example.com),getSentMail()wrapped the entire comma-separated string as a single address entry in the stored sent-mail copy:{ "value": [{ "address": "alice@example.com, bob@example.com" }] }The actual sending via Mailgun worked correctly (uses
addressParserwhich splits by comma), but the stored copy had incorrect structure.Fix
Add
parseRecipientAddresses()helper that splits by comma and trims each address before storing. Applied toto,cc,bccvalue arrays andenvelopeTo.{ "value": [{ "address": "alice@example.com" }, { "address": "bob@example.com" }] }Note: The existing
addressParserexport uses{ email }format for Mailgun API calls. The new helper uses{ address }which matches theMailtype's address format.Testing
Sent an email to multiple comma-separated recipients — verified stored copy now has correct per-address entries in the value array.
Closes #287