Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
There are a couple ways to accomplish this in sendmail but as you are not using sendmail as part of a fully fledged email server and only to send emails from your web scripts the following should do the trick:
<VirtualHost *:80>
Standard stuff goes here
<Directory /dir/to/your/web/root>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fuser@domain2.com"
</Directory>
</VirtualHost>
Adding this directive to your virtualhosts should set the default sender for the emails sent by your php scripts. In this case it is setting the sender to user@domain2.com for this virtualhost.
Be sure to restart apache after updating your configuration so the change can take effect.