Jump to content

mail() can't send via smtp


ashonline

Recommended Posts

Hi

I am currently updating a PHP-based website on a Windows 2003 web server. Everything seems to work ok except for a form which sends an email via an Exchange SMTP server on another server machine.

This worked ok when the website was on a server with an old version of PHP (3.something). It was talking to the same SMTP server which hasn't changed.

Web Server:
Windows 2003 SP1
IIS 6.0
PHP 5.2.0.0

The code snippet is as follows. It always executes the "else" statement.

[code]$From = $_REQUEST['from'];
$Subject = "White Papers Website Response";
$Body = "New User Registration
  \nName    : " . $title . " " . $firstname . "\n" . $lastname .
  "\nCompany : " . $company .
  "\nIndustry: " . $industry .
  "\nEmail  : " . $email .
  "\nPhone  : " . $phone;
$To = "[email protected]"; //$_REQUEST['sendto'];
  if (mail($To, $Subject, $Body, "From: " . $From . "\n X-Mailer: PHP/" .
    "Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" . phpversion() ) ){
      setcookie("registered", "true", time()+31536000);
      header("Location: white_papers.php");
    }
    else{
      $email_error = true;
    }[/code]

Can someone please assist? Any help much appreciated!

Thanks

Ash
Link to comment
https://forums.phpfreaks.com/topic/34375-mail-cant-send-via-smtp/
Share on other sites

Unfortunately i don't have access to the old PHP installation - the server machine was upgraded from Win2000/PHP3 to Win2003/PHP5.
The php.ini file has the following lines:

SMTP = pa01
smtp_port = 25
sendmail_from = [email protected]

Exchange is on the 'pa01' server.

I believe the issue does lie with the PHP installation as opposed to the code as the website works fine on my personal Fedora/PHP5 server.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.