Execute script in background

I have a slight issue with my code which I have been trying to handle. I am trying to send mail using php at different times in my project and most of them are user triggered. Since there are different mailing points and pages, I created a single mailing script where I send all the mailing requests to (that way, all emails are sent from a single page).