[GH-ISSUE #251] Sending mails with HTTP API #163

Closed
opened 2026-03-15 12:56:12 +03:00 by kerem · 4 comments
Owner

Originally created by @shyim on GitHub (Feb 24, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/251

It would be nice if we could send also mails to mailpit using HTTP requests. Maybe the API should be like:

(there is no standard 😭 )

For my use-case I don't need something really specific, as I could adopt it, but for people outside it makes sense to use a existing API format to kinda just exchange the endpoint to mailpit and it works.

I am not sure if this is 100% the scope of Mailpit as an simple HTTP to smtp application before can do it kinda too 😅.

Originally created by @shyim on GitHub (Feb 24, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/251 It would be nice if we could send also mails to mailpit using HTTP requests. Maybe the API should be like: - [AWS SES](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html) - [Sendgrid](https://docs.sendgrid.com/for-developers/sending-email/api-getting-started) - [Mailgun](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Messages/#tag/Messages/operation/httpapi.(*apiHandler).handler-fm-18) - [Mailchannels](https://blog.mailchannels.com/mailchannels-enables-free-email-sending-for-cloudflare-workers-customers/) (there is no standard 😭 ) For my use-case I don't need something really specific, as I could adopt it, but for people outside it makes sense to use a existing API format to kinda just exchange the endpoint to mailpit and it works. I am not sure if this is 100% the scope of Mailpit as an simple HTTP to smtp application before can do it kinda too 😅.
kerem closed this issue 2026-03-15 12:56:17 +03:00
Author
Owner

@axllent commented on GitHub (Feb 24, 2024):

This has been discussed a couple of times in previous GitHub issues ) search aes or mailgun) - basically requests to mimic the functionality (reverse engineer) that some of these protocols (which I will not do as it will be a lot of work to maintain). As you said, there is no standard, so it's a moving target. For these I suggested they build a "bridge' with an API and then that bridge can push the messages over SMTP to Mailpit, but I don't think any of them were keen to do the work themselves 😅

But your request seems a bit different, not specific to any specific one, just to be able to ingest messages over http. I would like to know why exactly? What would be the reason you want/need to integrate with yet another http API rather than to use the most common one in the world, SMTP?

<!-- gh-comment-id:1962344141 --> @axllent commented on GitHub (Feb 24, 2024): This has been discussed a couple of times in previous GitHub issues ) search aes or mailgun) - basically requests to mimic the functionality (reverse engineer) that some of these protocols (which I will not do as it will be a lot of work to maintain). As you said, there is no standard, so it's a moving target. For these I suggested they build a "bridge' with an API and then that bridge can push the messages over SMTP to Mailpit, but I don't think any of them were keen to do the work themselves 😅 But your request seems a bit different, not specific to any specific one, just to be able to ingest messages over http. I would like to know why exactly? What would be the reason you want/need to integrate with yet another http API rather than to use the most common one in the world, SMTP?
Author
Owner

@shyim commented on GitHub (Feb 24, 2024):

I am using https://workers.cloudflare.com for my application, so I am sticking to HTTP. When running the app locally with their "emulator", I would like to send the mails to a local mailpit instance. Right now I am console.log the mail, when in dev mode 😅 . See example of the app, maybe helps more to understand https://github.com/FriendsOfShopware/shopmon/blob/main/api/src/mail/mail.ts#L16

So any kind of API would help me here :)

<!-- gh-comment-id:1962347091 --> @shyim commented on GitHub (Feb 24, 2024): I am using https://workers.cloudflare.com for my application, so I am sticking to HTTP. When running the app locally with their "emulator", I would like to send the mails to a local mailpit instance. Right now I am console.log the mail, when in dev mode 😅 . See example of the app, maybe helps more to understand https://github.com/FriendsOfShopware/shopmon/blob/main/api/src/mail/mail.ts#L16 So any kind of API would help me here :)
Author
Owner

@axllent commented on GitHub (Feb 24, 2024):

I see where this is going, or to be more specific, where it will end up going (through no fault of your own).... Let's say I created a basic http end point to send mail, eg: some basic to, from, cc, subject, body fields etc - then the next user wants to add attachments, the next to insert custom headers, the next to support DKIM signatures etc etc. Before long, I Mailpit has its own complete custom implementation of one of those services you listed earlier 😂

Whilst the idea might sound good, there is no standard between these, so we're back to the start (the original requests for compatibility with each of these various services. Yes a great idea, but a lot of ongoing work... Especially when those services bring out new features.

I have another idea which I think you could (and probably should) do - why not just send your email directly to Mailpit via SMTP from JavaScript? I saw there is a library which does just that. I'm on my phone so I haven't looked too much into it, but from what I can see it should do exactly what want?

<!-- gh-comment-id:1962643616 --> @axllent commented on GitHub (Feb 24, 2024): I see where this is going, or to be more specific, where it will end up going (through no fault of your own).... Let's say I created a basic http end point to send mail, eg: some basic to, from, cc, subject, body fields etc - then the next user wants to add attachments, the next to insert custom headers, the next to support DKIM signatures etc etc. Before long, I Mailpit has its own complete custom implementation of one of those services you listed earlier 😂 Whilst the idea might sound good, there is no standard between these, so we're back to the start (the original requests for compatibility with each of these various services. Yes a great idea, but a lot of ongoing work... Especially when those services bring out new features. I have another idea which I think you could (and probably should) do - why not just send your email directly to Mailpit via SMTP from JavaScript? I saw there is a [library](https://smtpjs.com/) which does just that. I'm on my phone so I haven't looked too much into it, but from what I can see it should do exactly what want?
Author
Owner

@shyim commented on GitHub (Feb 24, 2024):

Ahh, yea had kinda the same feeling. I will look for another solution :).

Thanks you for maintaining mailpit!

<!-- gh-comment-id:1962731212 --> @shyim commented on GitHub (Feb 24, 2024): Ahh, yea had kinda the same feeling. I will look for another solution :). Thanks you for maintaining mailpit!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#163
No description provided.