I have a site (let's say http://mysite.com) that is being served from its own Virtual Server. The site is written in php.
Mail for this site is handled by a separate server. Everything is working correctly here for 'normal' mail (in other words MX and the such like appears to be ok and the mail server seems to be working correctly).
There are a number of places where email is sent from the website to the site administrators and a few of these are done via cron jobs on the server. One typical example is a housekeeping script that runs daily just to check there are no broken records in certain parts of the db and sends admins an email to confirm that everything is ok.
When it sends mail to a different domain (eg my copy goes to email@example.com) everything is fine. However when it sends to a user at mysite.com, the web server tries to process the email internally. If the email is already set up locally (eg firstname.lastname@example.org) it is stored in the associated users mailbox. If it doesn't then the mail sending fails, even if the email address is correct based on the addresses configured on the mail server. Both of these behaviours are incorrect - we need it to relay the mail on to the mail server regardless.
What is slightly odd is that mail sent from the site via contact forms and so-on appears to be working correctly, even tho in both cases they are just using the php mail() function to send the mail.
Can anyone give me any pointers as to how to go about changing things so that mail for mysite.com is handled by the mail server rather than the web server.