My CentOS server has several IP addresses. There are different virtualhosts configured per IP address on apache. When I send an email via PHP/sendmail, I want that sendmail uses the hostname that is matched to the IP configured in the /etc/hosts file.
Is that possible?
Sendmail won't know which host the client connected to. You'll need to lookup the hostname and use it in creating your addresses.
Sendmail will send from one IP address. This is normal behavior, and you are unlikely to be penalized by recipient's servers because of this. However, if you do generate spam and get blacklisted all traffic will be penalized.
Configuring an address so it is considered a trusted sender takes a little work. Get the one IP address sendmail is using setup correctly.