Re: PEAR Mail/smtp sending problem

From: Date: Mon, 31 May 2004 10:13:47 +0000
Subject: Re: PEAR Mail/smtp sending problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187269@lists.php.net to get a copy of this message
Christopher J. Mackie wrote:
I'm following the PEAR docs to use Mail/SMTP. Below is the code I use, swiped directly from the docs--I've changed the authorization data to protect privacy, but otherwise it's identical (and email sent from a client on this same machine using the same settings works fine). I'm running PHP 4.3.6 ISAPI on Win2k3 Server, IIS6.0. No errors are generated back to me, but the messages aren't going through. I can't see the smtp server logs, so I don't know what's failing.
Well, there might be errors that you aren't seeing. I have modified your code, run it and see if you get any new information :
<?php error_reporting(E_ALL);
require_once('Mail.php'); $recipients = 'joe@example.com'; $headers['From'] = 'cjm@princeton.edu'; $headers['To'] = 'joe@example.com'; $headers['Subject'] = 'Test message'; $body = 'Test message'; $params['host'] = 'smtpserver.princeton.edu'; $params['auth'] = TRUE; $params['username'] = 'cjm'; $params['password'] = 'mypass'; $params['port'] = '25'; $mail_object =& Mail::factory('smtp', $params); if (PEAR::isError($mail_object)) { die($mail_object->getMessage()); }
$mail_object->send($recipients, $headers, $body); if (PEAR::isError($mail_object)) { die($mail_object->getMessage()); }
?>


« previous php.general (#187269) next »