I have been tearing my hair out all day over this one.... we are currently migrating from a windows web server to a linux box with apache and php 5... however my mail scripts within our websites are causing us big problems! I can send mail to googlemail and yahoo, but if i try to send it to a custom mail server (i.e. our business mailserver) or an email address currently located at our old web server nothing is coming through. I'm not getting any errors when i send the mail though - the response comes back as '1', as in success....well surely no emails coming through means this is a lie?!?!?! I have a feeling it is a server side problem....as the script used to send the mail works for google/yahoo...but here is the code just in case:
include "/usr/share/php/Mail.php"; $date = date("D, d M Y H:i:s O"); $returnPath = "email@address"; $from = "email@address"; $to = $_POST['email']; $subject = "Forgotten Password - New Login Details"; $body = $message; $host = "localhost"; $username = "username"; $password = "password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject, 'Date' => $date, 'Return-path' => $returnPath); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body);
Can anyone help?? Obviously we don't want our clients without their mail facilities for very long!
Thanks in advance!