Skip to content

Add SMTP.com email provider - #55

Merged
eelcoj merged 1 commit into
Rails-Designer:mainfrom
pcbeingused333:add-smtpcom-provider
Aug 31, 2026
Merged

eelcoj merged 1 commit into
Rails-Designer:mainfrom
pcbeingused333:add-smtpcom-provider

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Adds SMTP.com as a transactional email provider.

Posts to https://api.smtp.com/v4/messages. Their payload differs from the other providers: recipients live under recipients, senders under originator, addresses use an address key instead of email, and the content is an array of MIME parts under body.parts.

SMTP.com requires a sender channel on every request, so it is exposed as a provider option (config.providers.smtpcom.channel) and raises a clear Courrier::ArgumentError when missing, following the Loops pattern.

Base64 is done with Array#pack("m0") rather than Base64.strict_encode64, to avoid adding the base64 bundled gem as a dependency on Ruby 3.4+.

  • lib/courrier/email/providers/smtpcom.rb — the provider
  • lib/courrier/email/provider.rb — require + registry entry
  • README.md — provider list plus the channel configuration example
  • test/courrier/email/providers/smtpcom_test.rb — body formatting, auth header, registry lookup, dropped optional fields, and the missing-channel error

Full suite passes locally: 105 runs, 200 assertions, 0 failures, 0 errors, 0 skips.

Part of #35 — ticks the SMTP.com box.

Three things worth flagging for review:

  1. Authentication. smtp.com's docs blocked my requests, so the Authorization: Basic base64("api:<key>") scheme comes from their official PHP SDK (SmtpSdk\HttpClient\HttpRequest), not from the docs. Worth confirming against a live account.
  2. Part encoding. Their docs say body parts default to base64, but their own SDK sends raw content with no encoding set. I went explicit — "encoding" => "base64" with encoded content — as the unambiguous reading.
  3. Naming. I used smtpcom / Smtpcom for consistency with the existing Smtp2go. Happy to rename if you'd prefer something else.

@eelcoj
eelcoj force-pushed the add-smtpcom-provider branch from 74ee42d to a69e992 Compare August 31, 2026 11:17
@eelcoj
eelcoj merged commit 662c9f6 into Rails-Designer:main Aug 31, 2026
1 check passed
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.

2 participants