No SMTP server? Can't get mail()

From: Date: Fri, 21 Jan 2011 03:45:46 +0000
Subject: No SMTP server? Can't get mail()
Groups: php.general 
Request: Send a blank email to php-general+get-310938@lists.php.net to get a copy of this message
I am having problems with mail(). The problem is that the email just never gets there. Mail appears to be working. To start, I am investigating the SMTP server. I can't understand some things. 1) I am sure that the smtp server is and is set to "localhost", but I want to verify this ... ------------------------------------------------------------------------------------------- error_reporting(E_ALL); echo 'display_errors = ' . ini_get('display_errors') . "\n"; echo 'register_globals = ' . ini_get('register_globals') . "\n"; echo "<br><br>"; echo "SMTP host: " . ini_get("smtp"); echo "SMTP port: " . ini_get("smtp_port"); echo "Sendmail From: " . ini_get("sendmail_from"); gets: 1 1 SMTP host: SMTP port: 25 Sendmail_from: Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from' in /home/ Obviously SMTP is defined (?? because it is not undefined?), but nothing is echo'd for SMTP. WHY? ------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
    then ...
ini_set( smtp, "localhost" );
    gets:
Notice: Use of undefined constant smtp - assumed 'smtp' in /home/ ... SMTP host: SMTP port: 25 Sendmail_from: ------------------------------------------------------------------------------------------- Strange, SMTP was defined before ????, and it still won't echo. ------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
      Both
error_reporting(E_ALL); ini_set( sendmail_from, "<sendmailfrom>@<localhost>" ); echo "SMTP host: " . ini_get("smtp"); echo "SMTP port: " . ini_get("smtp_port"); echo "Sendmail From: " . ini_get("sendmail_from"); $return = mail('<another user>@<localhost>', 'Test', 'Test'); var_dump($return);
     and
error_reporting(E_ALL); ini_set( sendmail_from, "<sendmailfrom>@<localhost>" ); ini_set( smtp, "localhost" ); echo "SMTP host: " . ini_get("smtp"); echo "SMTP port: " . ini_get("smtp_port"); echo "Sendmail From: " . ini_get("sendmail_from"); $return = mail('<another user>@<localhost>', 'Test', 'Test'); var_dump($return);
     return
no other errors SMTP host: SMTP port: 25 Sendmail_from: <sendmailfrom>@<localhost> and bool(true) Yet NO EMAIL is ever received/returned at the local email address or when outside email addresses are used, and never when mail() is seemingly successfully used in a script. WHY can't I echo the SMTP address being USED? What am I doing wrong? (Please note that phpinfo IS DISABLED ON MY SERVER BECAUSE IT IS A SECURITY THREAT) How am I going to get this emailing straightened out? -- Using Opera's revolutionary email client: http://www.opera.com/mail/

« previous php.general (#310938) next »