Skip to content

email: deliver to CC recipients via RCPT - #71

Open
draarivpatel-ui wants to merge 1 commit into
labstack:masterfrom
draarivpatel-ui:fix-cc-rcpt
Open

draarivpatel-ui wants to merge 1 commit into
labstack:masterfrom
draarivpatel-ui:fix-cc-rcpt

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Root cause

(*Email).Send writes the CC header into the message but only issues SMTP RCPT commands for the To addresses. SMTP delivers exclusively to RCPT recipients; header fields are cosmetic. As a result, any address in Message.CC never receives the message at all, despite the CC header claiming otherwise.

Fix

Parse m.CC with mail.ParseAddressList and issue RCPT commands for those addresses as well. A malformed CC now surfaces as an error instead of being silently dropped from delivery.

Test

Added TestSend_CCRecipients, which runs a minimal fake SMTP server over a real TCP connection, sends a message with one To and two CC addresses, and asserts all three receive RCPT commands. Verified the test fails before the fix (only 1 RCPT) and passes after (3 RCPTs).

The CC header was written into the message but CC addresses never
received an SMTP RCPT command. Since SMTP delivers only to RCPT
recipients, CC'd addresses never received the message at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant