mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-27 01:06:01 +03:00
[GH-ISSUE #193] Feature Request: Send email via API #126
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#126
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @otezz on GitHub (Oct 17, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/193
I am currently building an app with Cloudflare Workers and just figure out I am unable to use nodemailer as it is not compatible to run on Cloudflare Workers making me unable to send email via SMTP. There's no issue for production since I will be using API based mail service like MailChannels, SendGrid or SES, but for local development, I'm unable to test my email since mailpit only support sending email via SMTP.
What I'm imagining currently is an endpoint (
POST /mail) that accept payload bodyAnd then I will be able to review the email on the mailpit web UI
Thank you
@axllent commented on GitHub (Oct 17, 2023):
Hi @otezz. Whilst this is an interesting idea, this is unfortunately far too out-of-scope for Mailpit, which is fundamentally an SMTP testing tool (with a fancy UI to view the emails, plus related tools).
It is also not as simple as just those 5 array fields - emails are (or at least can be) constructed with far more than just those fileds. Take a look at this to get some idea of the complexity an API like this should have to handle mime parts, headers, attachments etc. An API like this would not only need to handle the input of all those fields & data types, but also need to construct an email with the data in order to be rendered. Even if I was to spend weeks/months building something like this, then I would also get requests for similar endpoints to mimic MailChannels, SendGrid, SES, Mailgun APIs etc - the list wouldn't end (there are hundreds).
If you really needed a solution like this, then you could build a "bridge" - a custom API that does what you want, which then constructs the email and sends it via SMTP (eg: to Mailpit). it would however need to run as a separate service on a separate port, though that shouldn't be an issue. I this it may be easier for you to just work out how to get SMTP running via Cloudflare Workers, as from what I can see the environment is just NodeJS?