There are many ways to approach that but given that you have an API you could just schedule a background job whenever your criteria are met.
So you receive an API request, you check whether your criteria are met, and if so you schedule an asynchronous email-sending job (in the background). Your API returns immediately.
This way if a job fails (for timeout or other reasons) you can see it, reschedule automatic retries, get nice logs/reporting etc. And you don't block your whole Rails app while waiting for the email to be sent.
There are many nice solutions for Rails background queuing systems including Sidekiq, resque, and delayed_job. I suggest that you go through their documentation to see which fits best your needs.