When I use the built in php mail function, the php script hangs for about 20 seconds before continuing. I think it should simply write a file to the postfix queue with the data to be mailed, which should take something like 0.1 seconds instead.
What is the best way to use system / exec to queue an email, alternatively to diagnose and solve the slowness problem?
See also my question regarding this at serverfault for some details and diagnostic data
This is probably not the the answer you’re looking for, but when I had the same issue, I figured out I could just flush the output back to nginx using fastcgi_finish_request, and keep the process running until the email is sent.
I see you are using Mac OSX Server, so just switching to nginx might end up causing more trouble than not. In my experience, however, it was well worth the effort.