ActionMailer and *nix Fork Question

Hello all -

I'm working on a project for a newsletter and customer contact management system that will be responsible for sending a large number of (non-spam) e-mails to customers. In the past, I put together a quick "hack" of a PHP script to do something similar for a one-time case, and ran into a problem that I'd like to ensure doesn't happen with my implementation of this in Rails.

Long story short, at the time, my PHP script looked something like this in pseudo-code foreach $person { send_email }

This had an unfortunate side effect caused by me not thinking - it didn't wait for mail() to finish, it kept spawning new mail processes in the operating system. As this was taking place on a VPS, it filled up RAM -very- quickly and caused the entire VPS instance to crash.

Needless to say, I'd like to avoid a similar situation with Rails!

So my question is, let's say I have one message that I'm sending to multiple people. In pseudo-code: @message = "Hello World!" for u in @users   some_actionmailer_module.deliver(arguments) end

Now let's also assume that I have an SMTP server set, and the delivery method is SMTP via the same host (defined by the actual domain name, not just "localhost" of course).

Will Rails automatically wait for each message to be sent without any further intervention from me, the programmer, or will it just keep processing and flooding SMTP as fast as the loop can execute?

If the latter, how can I instruct Rails to wait for the connection to be established, information transferred, and closed properly before continuing the loop?

Thank you very much for your time and your help =) ~ Phoenix