mattyb_53 Posted December 19, 2007 Share Posted December 19, 2007 Hi peeps. Got a bit of a question. Ive got an exchange 2003 server with IIS6. I want to be able to use the mail() function to send an email. I have the following code: <?php $to = 'me@mydomain.com.au'; $subject = "A subject of choice"; $message = "Line 1\nLine 2\nLine 3"; $headers = 'From: info@mydomain2.com.au' . "\r\n" . 'Reply-To: info@mydomain2.com.au' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); //send ini_set('SMTP','SERVERNAME'); ini_set('smtp_port','25'); ini_set('smtp_from','info@mydomain2.com.au'); //yes this is a valid email address on the exchange server echo "Sending email from " . ini_get('SMTP') . "</br>"; $result = mail($to, $subject, $message, $headers); if($result) echo "Send Successful."; else echo "Send Failed!"; ?> Thing is, the $result that is returned is true. So it should be successful in sending the email. And I cant find any trace of the email being queued on the exchange server. The log file for exchange indicates a message was relayed. To double check, I granted 127.0.0.1 and localhost relay rights. I also read up about using sockets, eg fputs and fgets to send a telnet command and receive a response. It gets stuck on the DATA command. Anyone seen this before? ??? Link to comment Share on other sites More sharing options...
Recommended Posts