Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added send message API endpoint #279

Closed
wants to merge 1 commit into from

Conversation

ryan0x44
Copy link

@ryan0x44 ryan0x44 commented Apr 18, 2024

This adds an API endpoint for sending messages via HTTP, per feature request #278

Example usage:

 curl -X POST http://localhost:8025/api/v1/messages \
     -H "Content-Type: application/json" \
     -d '{
          "from": { "email": "[email protected]" },
          "to": [{
              "email": "[email protected]"
          }],
          "subject": "hello",
          "html": "<html><body>Hello</body></html>",
          "text": "Hello"
        }'

Note that in order to re-use code, I had to make the smtpd package mailHandler method public.

Open to suggestions for any changes but thought it would be nice to put something together to at least solve my immediate need.

Thanks for building mailpit!

@ryan0x44 ryan0x44 force-pushed the send-message-api branch from 3faf69b to 25fd4cb Compare May 1, 2024 03:26
@ryan0x44 ryan0x44 force-pushed the send-message-api branch 2 times, most recently from c03c34e to 9bbefd5 Compare May 1, 2024 23:46
@ryan0x44 ryan0x44 force-pushed the send-message-api branch from 9bbefd5 to 02ab5b3 Compare May 1, 2024 23:53
@axllent
Copy link
Owner

axllent commented May 3, 2024

This functionality was added via this commit and released in v1.8.0, so this PR no longer needed. Thanks again for your contribution, it was useful.

@axllent axllent closed this May 3, 2024
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