I have the following script:
<?php include('Mail.php'); include('Mail/mime.php'); $recip = "me <email@example.com>"; $strSubject = "test subject"; $strMessage = "test message"; $crlf = "\n"; $headers = array('From' => $recip, 'Return-Path' => $recip, 'Subject' => $strSubject); $mime = new Mail_mime($crlf); $mime->setTXTBody($strMessage); $body = $mime->get(); $headers = $mime->headers($headers); $smtp_params["host"] = "localhost"; $smtp_params["port"] = "25"; $mail =& Mail::factory("smtp", $smtp_params); //$mail =& Mail::factory('mail'); $confirmation = $mail->send($recip, $headers, $body); if ($confirmation) echo "accepted"; else echo "not accepted"; ?>
I have postfix running on the server. The script gives me no php errors and postfix shows nothing in log when I execute. when I swich the factory lines (switch the commenting) the script sends email and postfix logs the connection. I put default master.cf and main.cf files for postfix, reloaded and restarted.
I am not very well versed with the email side of servers. Any info would be great. Might there be any error messages stored somewhere concerning the failure to connect? I've tried various $smtp_params options but I'm just shooting in the dark. Any ideas would be greatly appreciated.