Skip to content

Conversation

GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Oct 13, 2025

When using the replyAll option in the Gmail "Send Email" action, it would split the "from" and "to" values by comma in an attempt to retrieve multiple comma-separated emails. This caused a problem when the email itself included a comma in the name (e.g. "Falcao, Guilherme" <guilherme@nowhere.com>

Using addressparser from nodemailer ensures proper parsing of these fields

Note: I only bumped the version of the send-email component, because it is the only component that uses the replyAll prop, and the logic was only changed in the block that checks for this prop.

Summary by CodeRabbit

  • Bug Fixes

    • Improved parsing and normalization of email addresses for To, CC, and BCC fields, reducing errors with complex or combined addresses.
    • More accurate address handling when composing replies and Reply All, ensuring correct recipients are included.
  • Chores

    • Bumped Gmail integration and send-email action versions for a patch release.

Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Oct 13, 2025 6:05pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 13, 2025 6:05pm

Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds robust RFC 5322 address parsing via nodemailer’s addressparser in the Gmail app, updates email composition to use parsed arrays for to/cc/bcc (including reply-all flows), bumps the action metadata version for send-email, and increments the package version.

Changes

Cohort / File(s) Change Summary
Gmail App: address parsing integration
components/gmail/gmail.app.mjs
Added parseEmailAddresses(addressString) using nodemailer’s addressparser; integrated parsed arrays into getOptionsToSendEmail for to/cc/bcc and reply-all handling; imported addressparser.
Send Email action: metadata bump
components/gmail/actions/send-email/send-email.mjs
Updated exported action metadata version from "0.1.16" to "0.1.17".
Package manifest: version bump
components/gmail/package.json
Bumped package version from 1.3.2 to 1.3.3; no dependency changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as User
  participant Composer as Email Composer
  participant App as Gmail App
  participant Parser as nodemailer addressparser
  participant Gmail as Gmail API

  User->>Composer: Compose email (to/cc/bcc, replyAll)
  Composer->>App: getOptionsToSendEmail(input)
  App->>Parser: parseEmailAddresses(to/cc/bcc)
  Parser-->>App: Arrays of normalized addresses
  App->>Gmail: Send with parsed to/cc/bcc
  Gmail-->>App: Message ID / status
  App-->>Composer: Options / result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit parsed each line with care,
From tangled strings to emails fair.
To, CC, BCC now clean and bright,
Reply-all trails aligned just right.
With version bumps we onward hop—
Another tidy, ship-shaped stop. 🐇✉️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository’s required template because it omits the “## WHY” section heading and does not explicitly structure the explanation under that header. Please update the description to include the “## WHY” heading from the template and provide the rationale under that section to ensure the template structure is followed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary change of fixing address parsing in the Gmail action’s replyAll option by referencing the relevant feature and issue without including extraneous details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/gmail/gmail.app.mjs (1)

329-336: Add null safety checks for from/to headers.

The code uses .find() to locate headers, which returns undefined if not found. Accessing .value on undefined would throw a runtime error. While emails typically have From and To headers, defensive coding is essential here.

Apply this diff to add null safety:

           if (props.replyAll) {
             const from = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "from");
             const to = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "to");
             const cc = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "cc");
             const bcc = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "bcc");
-            opts.to = [
-              ...this.parseEmailAddresses(from.value),
-              ...this.parseEmailAddresses(to.value),
-            ];
+            
+            const fromAddresses = from ? this.parseEmailAddresses(from.value) : [];
+            const toAddresses = to ? this.parseEmailAddresses(to.value) : [];
+            opts.to = [...fromAddresses, ...toAddresses];
🧹 Nitpick comments (2)
components/gmail/package.json (1)

23-23: Consider updating nodemailer to latest 6.x for parsing improvements.

The current constraint ^6.7.8 allows upgrading to 6.10.0, which includes address parsing fixes and security improvements mentioned in the learnings.

Based on learnings: nodemailer 6.10.0 (released 2025-01-23) includes address parsing fixes that may further improve the reliability of the parseEmailAddresses implementation.

components/gmail/gmail.app.mjs (1)

277-297: Well-implemented address parsing utility.

The method correctly handles edge cases with input validation and uses nodemailer's addressparser for RFC 5322 compliance. This solves the comma-in-display-name issue mentioned in the PR.

For additional robustness, consider wrapping the addressparser call in a try-catch block:

     // Use nodemailer's addressparser to properly handle RFC 5322 format
-    const parsed = addressparser(addressString.trim());
+    try {
+      const parsed = addressparser(addressString.trim());
+      // Reconstruct addresses in standard format
+      return parsed.map((addr) => {
+        if (addr.name) {
+          return `${addr.name} <${addr.address}>`;
+        }
+        return addr.address;
+      });
+    } catch (error) {
+      console.warn('Failed to parse email addresses:', error);
+      return [];
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f84b6d and 781e943.

📒 Files selected for processing (3)
  • components/gmail/actions/send-email/send-email.mjs (1 hunks)
  • components/gmail/gmail.app.mjs (4 hunks)
  • components/gmail/package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/gmail/gmail.app.mjs (1)
components/gmail/actions/send-email/send-email.mjs (1)
  • opts (123-123)
🪛 GitHub Actions: Components Checks
components/gmail/package.json

[error] 1-1: Version of 19 dependencies needs to be increased. Detected in diffs: send-email action version 0.1.16 -> 0.1.17 and package.json dependency version 1.3.2 -> 1.3.3.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pnpm publish
🔇 Additional comments (3)
components/gmail/actions/send-email/send-email.mjs (1)

9-9: LGTM!

Version bump aligns with the PR objectives. Since this action is the sole consumer of the replyAll property and the underlying logic was fixed in gmail.app.mjs, this version increment is appropriate.

components/gmail/gmail.app.mjs (2)

9-9: LGTM!

Importing addressparser from nodemailer's internal modules is the correct approach for RFC 5322 address parsing.


352-357: LGTM!

The cc and bcc parsing includes proper null checks before accessing .value, preventing potential runtime errors. The implementation correctly applies the new parsing logic.

@GTFalcao GTFalcao moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog Oct 14, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to Ready for Release in Component (Source and Action) Backlog Oct 14, 2025
@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test report
https://vunguyenhung.notion.site/Gmail-fixing-address-parsing-in-replyAll-option-28cbf548bb5e819e960ee39b1f82b279

@GTFalcao
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit ca56be6 into master Oct 14, 2025
9 of 10 checks passed
@michelle0927 michelle0927 deleted the gmail-address-parse-fix branch October 14, 2025 14:42
@github-project-automation github-project-automation bot moved this from Ready for Release to Done in Component (Source and Action) Backlog Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants