Sending an e-mail through a function

Hello,

I am using PHP to send e-mail to people who subscribe to other users posting content. I call the function and it retrieves the e-mails which have subscribed to this user who has posted something.

Then I use the mail() function however it will not work when I try to put headers on the e-mail such as the From or Reply-To header.

Any ideas? I have already tested the mail and it works outside of the function.

Thanks