Re: PEAR Mail Authentication Problems

From: Date: Fri, 03 Oct 2003 11:33:59 +0000
Subject: Re: PEAR Mail Authentication Problems
References: 1  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-8256@lists.php.net to get a copy of this message
you should test whether you can telnet into the mailserver from the webserver.. eg. telnet smtp.mymailserver.net 25 looks like you may have the wrong server or may not be permited to send email on that server. Regards Alan Charles Kline wrote:
Hello, I have tracked my troubles with using the PEAR Mail class to smtp authentication failing. Here is what I have: <?php require 'Mail.php'; $to = 'ckline@mymailserver.net'; $headers['From'] = 'website@mymailserver.net'; $headers['Subject'] = 'Testing'; $body = 'hey it worked'; $params['host'] = "smtp.mymailserver.net"; $params['auth'] = "TRUE"; $params['username'] = "ckline"; // have also tried ckline@smtp.mymailserver.net $params['password'] = "mypassword"; $message =& Mail::factory('smtp', $params); $result = $message->send($to, $headers, $body); echo "<pre>"; var_dump($result); echo "</pre>"; ?> The results of the var_dump() are this: object(pear_error)(8) { ["error_message_prefix"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> NULL ["message"]=> string(37) "unable to authenticate to smtp server" ["userinfo"]=> NULL ["backtrace"]=> array(2) {
    [0]=>
    array(6) {
      ["file"]=>
      string(32) "/usr/local/lib/php/Mail/smtp.php"
      ["line"]=>
      int(147)
      ["function"]=>
      string(10) "pear_error"
      ["class"]=>
      string(10) "pear_error"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(1) {
        [0]=>
        string(37) "unable to authenticate to smtp server"
      }
    }
    [1]=>
    array(6) {
      ["file"]=>
      string(69) "/contact/send.php"
      ["line"]=>
      int(13)
      ["function"]=>
      string(4) "send"
      ["class"]=>
      string(9) "mail_smtp"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(3) {
        [0]=>
        string(25) "ckline@smtp.mymailserver.net"
        [1]=>
        array(2) {
          ["From"]=>
          string(26) "website@smtp.mymailserver.net"
          ["Subject"]=>
          string(7) "Testing"
        }
        [2]=>
        string(13) "hey it worked"
      }
    }
} ["callback"]=> NULL }
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.general (#8256) next »