Re: No SMTP server? Can't get mail()

From: Date: Sun, 23 Jan 2011 00:44:03 +0000
Subject: Re: No SMTP server? Can't get mail()
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-310975@lists.php.net to get a copy of this message
On Fri, 21 Jan 2011 13:41:21 +0700, Peter Lind <peter.e.lind@gmail.com> wrote:
Probably not the solution you were looking for, but I've always found mail() very unstable and I tend to use a mail library instead. Like phpmailer or swiftmailer. Easier to configure and figure out problems with. Regards Peter
Peter, that is warranted advice here. I'm a little new to PHP. I'm set up to develop Apache/PHP/MySQL on my PC uploading results to a unix server. My situation here is that I am trying to get a PHP Mailing List program running for a friend's business web site (on unix). That program has 2 options for mailing: 1) mail()/SMTP and 2) phpmailer options. Mail()/SMTP works, at least, on my PC. But I can't get either of the two emailing options to work on the UNIX server. (Whatever those mail problems are, it is mangled with odd PHP/MySQL problems on unix). I'm just 'back here' starting debugging with the mail()/SMTP option on unix and my conclusion based on feedback above (thank you) is that email IS reaching the unix SMTP server but is not being forwarded (and that's unresolved now). My mentioned "SMTP server echo problem" is irrelevant. Maybe they fixed it last night, or maybe I was smoking something yesterday. It IS echoing correctly. I finally figured out that part of my problem was misunderstanding a warning message caused by my not single quoting SMTP (yikes!). Or maybe I was just enraged over my lack of success all day yesterday to confirm Apache server information on the unix server (which would help me guarantee that I have the same Apache/PHP/MySQL configurations between the PC and unix servers). But today the SMTP server info IS echo'd on the unix server. From the Unix server ... ------------------------------------------------------------------------------- <?php function apacheversion() {
              $ver = split("[/ ]",$_SERVER['SERVER_SOFTWARE']);
              $apver = "$ver[1] $ver[2]";
           return $apver;
} echo "<br>"; print ('Apache Version: ' . apacheversion()); echo "<br>"; print ($_SERVER["SERVER_SIGNATURE"]); print ($_SERVER["SERVER_SOFTWARE"]); echo "<br>"; ?> <?php echo "<br>"; echo PHP_OS; $os = php_uname(); echo 'OS' . "$os"; echo "<br><br>"; ?> <?php 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 "<br>"; echo "smtp_port: " . ini_get("smtp_port"); echo "<br>"; echo "sendmail_from: " . ini_get("sendmail_from"); echo "<br><br>"; ?> <?php // prints e.g. 'Current PHP version: 4.1.1' echo 'Current PHP version: ' . phpversion(); echo "<br><br>"; // prints e.g. '2.0' or nothing if the extension isn't enabled echo phpversion('mysqli'); echo "<br><br>"; ?> <?php $link = mysql_connect('localhost', 'xxxxxx', 'xxxxxx'); if (!$link) {
                                      die('Could not connect: ' .
mysql_error()); } printf("MySQL server version: %s\n", mysql_get_server_info()); echo "<br><br>"; ?> <?php phpinfo(); ?> -------------------------------------------------------------------- gets: Apache Version: Apache LinuxOSLinux clientx.xxxxxx.com 2.4.33.2 #4 SMP Wed Aug 23 10:41:21 EDT 2006 i686 display_errors = 1 register_globals = 1 SMTP host: localhost smtp_port: 25 sendmail_from: Current PHP version: 4.4.4 MySQL server version: 5.0.67-community Warning: phpinfo() has been disabled for security reasons in /home/xxxxxxxxxxxxxxxxxxxxxxx/php/unameunix.php on line 57 -- Using Opera's revolutionary email client: http://www.opera.com/mail/

« previous php.general (#310975) next »