o4oren / Ad-Hoc-Email-Server

An ad-hoc disposable temporary mail server. Create and use ad hoc disposable mailboxes for testing or any other purpose.
Apache License 2.0
383 stars 91 forks source link

Programmatic API ? #69

Open KaKi87 opened 2 years ago

KaKi87 commented 2 years ago

Hello,

Is there, or could there be, a programmatic API, for this server, so that it can be dynamically used by a parent script to start, receive and stop ?

Thanks

o4oren commented 2 years ago

You can think if different solution. First, yoy can startnit by calling node ahem.js. Get the pid and kill as needed. You couls also use something like pm2 to start and stop it with a command. I am sure there are other ways.

On Tue, Mar 22, 2022, 21:02 KaKi87 @.***> wrote:

Hello,

Is there, or could there be, a programmatic API, for this server, so that it can be dynamically used by a parent script to start, receive and stop ?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/o4oren/Ad-Hoc-Email-Server/issues/69, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTF65VSTY7LENUEVOHGGW3VBIKMTANCNFSM5RLY7XWQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

KaKi87 commented 2 years ago

That could work for starting and stopping, but what about receiving ?

gcleaves commented 2 years ago

Hi, not sure what you mean exactly by receiving, but I added a webhook parameter to the environment variables which was merged into the project and works well for me.

Anytime an email arrives, Ahem hits the webhook with the email contents so you can react accordingly.

On Wed, 23 Mar 2022, 13:46 KaKi87, @.***> wrote:

That could work for starting and stopping, but what about receiving ?

— Reply to this email directly, view it on GitHub https://github.com/o4oren/Ad-Hoc-Email-Server/issues/69#issuecomment-1076335461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH6GZLPDWH6ZNQBAI4K673VBMHCHANCNFSM5RLY7XWQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

KaKi87 commented 2 years ago

So, to programmatically receive emails, I must create a local HTTP server ?

This seems very dirty.

gcleaves commented 2 years ago

Here's the merge for the dirty solution. https://github.com/o4oren/Ad-Hoc-Email-Server/pull/36

Some of us are trying to take Ahem places the author never planned, but he seems open to accepting merge requests.

o4oren commented 2 years ago

When up, ahem server exposes a restful api. You can just pick it up in the debug console when using the ui. Thanks

On Wed, Mar 23, 2022, 14:46 KaKi87 @.***> wrote:

That could work for starting and stopping, but what about receiving ?

— Reply to this email directly, view it on GitHub https://github.com/o4oren/Ad-Hoc-Email-Server/issues/69#issuecomment-1076335461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTF65RPNWTTMGKDBK4XZU3VBMHCFANCNFSM5RLY7XWQ . You are receiving this because you commented.Message ID: @.***>