Handling ctrl+c for graceful shutdown with SIGINT

Hi there, thanks for making and sharing this!

I'm trying to use mailin-embedded in my project. I'm trying to run the embedded server next to an Actix web server.

tokio::spawn_blocking(move || {
    server.serve();
});

The problem is that now my project no longer listens to ctrl+c. I can't shut it down without a forceful SIGKILL.

Maybe it makes sense to implement tokio's ctrl_c handler? See graceful shutdown. Would be very nice to allow shutdown after the mails are sent. I read in #9 that it's not likely to support async functionality, so perhaps this approach won't work. Maybe there's a different way to shut it down semi-gracefully? A function that returns a stop or something?

Thanks anyways!

Edited by Joep Meindertsma