Apache, virtual hosts, and default sender for sendmail

So here's my issue...I have two sites hosted on one machine using apache's virtual hosts. I want to send emails from the two different sites (domain.com and domain2.com) using the appropriate email addresses. I currently have this value in php.ini:

sendmail_path = /usr/sbin/sendmail -t -i [email protected]

But when I try sending an email from a script on domain2.com it obviously is delivered with a From: [email protected] header. Apache doesn't allow you to set a rule like this from within the <VirtualHost> directive:

php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected]"

So what's the best way to accomplish this? I've tried setting php_admin_value mail.force_extra_parameters "[email protected]" from within the domain2.com's <VirtualHost> directive but all emails are still coming from domain.com. Any ideas?


Although you're not allowed to set the sendmail_path from within the <VirtualHost> directive, you can set it within the <Directory> directive. So I simply have something that looks like this:

<VirtualHost *:80>
    Standard stuff goes here

    <Directory /dir/to/your/web/root>
        php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected]"
    </Directory>

</VirtualHost>

I'm not sure if it's the most proper or elegant way to accomplish this, but it definitely worked. Sorry it took so long to respond, I don't go on SF that frequently and forgot about this question.