Jump to content

[SOLVED] mail() and exchange doing strange things


mattyb_53

Recommended Posts

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.