Skip to content

feat(BOUN-1955): Second part of SMTP implementation#88

Merged
blind-oracle merged 11 commits into
mainfrom
igor/smtp-gateway-v2
May 21, 2026
Merged

feat(BOUN-1955): Second part of SMTP implementation#88
blind-oracle merged 11 commits into
mainfrom
igor/smtp-gateway-v2

Conversation

@blind-oracle
Copy link
Copy Markdown
Contributor

  • Implement to SMTP->IC part: IcSmtpDeliveryAgent
  • Hide SMTP stuff under a feature flag
  • Performance improvements in SMTP library (use ArrayString, pre-render EHLO/HELO etc)
  • Other changes here and there

@blind-oracle blind-oracle requested a review from a team as a code owner May 20, 2026 13:23
@blind-oracle blind-oracle requested a review from Copilot May 20, 2026 13:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the “SMTP → IC” direction by introducing an IC-backed delivery/recipient-resolution implementation and gating the SMTP subsystem behind a new smtp feature, alongside performance-focused changes in the SMTP inbound server.

Changes:

  • Added IC SMTP request execution + IcSmtpDeliveryAgent to validate recipients and deliver parsed MIME messages to IC canisters.
  • Optimized SMTP inbound path (pre-rendered HELO/EHLO responses, reduced allocations for replies/errors).
  • Introduced smtp feature flag and updated dependencies/exports accordingly.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
ic-bn-lib/tools/smtp_server.rs Removes the standalone SMTP server tool binary source.
ic-bn-lib/src/smtp/server.rs Adds accept() failure throttling and cleans imports.
ic-bn-lib/src/smtp/mod.rs Renames/extends core SMTP types (e.g., EmailMessage, richer resolve errors, from passed to resolver).
ic-bn-lib/src/smtp/inbound/session.rs Allocation reductions in replies/errors; adjusts state machine responses.
ic-bn-lib/src/smtp/inbound/rcpt_to.rs Passes sender to resolver; richer error mapping; avoids heap formatting.
ic-bn-lib/src/smtp/inbound/mod.rs Precomputes HELO/EHLO responses; adds SMTP caps; updates/extends tests.
ic-bn-lib/src/smtp/inbound/mail_from.rs Adds sender-domain validation and allocation reduction for SPF error messages.
ic-bn-lib/src/smtp/inbound/ehlo.rs Switches EHLO/HELO output to pre-rendered buffers.
ic-bn-lib/src/smtp/ic/mod.rs Adds IC SMTP request executor trait/impl and MIME→candid message parsing.
ic-bn-lib/src/smtp/ic/delivery_agent.rs Implements IC-backed delivery + recipient validation, including MX canister lookup + caching.
ic-bn-lib/src/smtp/ic/candid.rs Updates candid model (notably Envelope.to becomes a list) and derives equality.
ic-bn-lib/src/smtp/address.rs Adds conversions to candid Address and parsing helper; adds PartialEq<&str>.
ic-bn-lib/src/lib.rs Gates smtp module behind feature; adds email! macro.
ic-bn-lib/src/custom_domains/mod.rs Introduces LooksUpCustomDomain abstraction for SMTP IC integration.
ic-bn-lib/Cargo.toml Adds smtp feature; makes SMTP deps optional; removes smtp-server bin entry; adds dev-dep for tests.
Cargo.toml Adds workspace deps for arrayvec and mail-send.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ic-bn-lib/src/smtp/inbound/ehlo.rs
Comment thread ic-bn-lib/src/smtp/inbound/session.rs
Comment thread ic-bn-lib/src/smtp/ic/mod.rs
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs
Comment thread ic-bn-lib/src/smtp/inbound/session.rs Outdated
Comment thread ic-bn-lib/src/smtp/inbound/mod.rs Outdated
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs Outdated
Comment thread ic-bn-lib/src/smtp/ic/mod.rs
Comment thread ic-bn-lib/src/smtp/inbound/session.rs
Comment thread ic-bn-lib/src/smtp/address.rs
Comment thread ic-bn-lib/src/smtp/address.rs
Comment thread ic-bn-lib/src/lib.rs
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs
Comment thread ic-bn-lib/src/smtp/ic/delivery_agent.rs
@blind-oracle
Copy link
Copy Markdown
Contributor Author

@frankdavid thanks for the review! 👍 I'll merge this as-is now and will address the comments in the next PR for simplicity.

@blind-oracle blind-oracle merged commit 9093b40 into main May 21, 2026
6 checks passed
@blind-oracle blind-oracle deleted the igor/smtp-gateway-v2 branch May 21, 2026 12:21
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.

3 participants