A client has a website that is remotely hosted on a shared server. He also has an exchange server that listens for mail sent his domain name, which is the same domain name as his website. So, the MX records for the domain name are pointed to his exchange IP address while the DNS records are pointed to the website server IP address. Make sense?
On the website I have a form that customers fill out. I want the results from the form to be sent to the sales guy. I'm just using mail(). The mail never makes it to the exchange server. If I check for the mail on the web host's webmail, I can find it there. If I send the mail to my personal email account (ie, any account that isn't the same domain name as the website) the mail makes it.
Is this a PHP or a DNS problem? Can I trick PHP to send the mail to an IP address rather than the domain name, like user@122.22.22.22?
mail() problems
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I think you can use Swiftmailer (http://www.swiftmailer.org) to address that issue. I think mail() uses sendmail as a default, which might be causing you problems. Another thing to do is test mail() using a conditional to see if it was accepted my the mail server for delivery.
Code: Select all
<?php
if (mail($to, $subject, $msg))
{
echo 'It was accepted for delivery';
}
else
{
echo 'Crapola';
}
?>
Last edited by RobertGonzalez on Sat Mar 03, 2007 9:04 am, edited 1 time in total.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia