Skip to main content

localhost gives dovecot authenticator error using trying to auth smtp to external server

Comments

5 comments

  • Infopro
    The code in your script is probably what's in need of some attention. This isn't a cPanel issue, it's an issue with your script.
    0
  • FirstMM
    [quote="Infopro, post: 1607362">The code in your script is probably what's in need of some attention. This isn't a cPanel issue, it's an issue with your script.
    Thanks for taking the time to reply Infopro :) The code works fine when run as root from the server which is why I am confused! Why would it run correctly as root (i.e. hit the remote server directly and correctly) and yet hit the local server POP before SMTP when run as the domain user if it is an error in the code? In order to 100% guarantee that the code is not at fault (I took your suggestion seriously), I added it to another non cPanel server and it ran fine from there (not running as root but as a standard user).
    0
  • Infopro
    No way of knowing without seeing the script I don't think.
    0
  • FirstMM
    [quote="Infopro, post: 1607782">No way of knowing without seeing the script I don't think.
    lol if it will make you happy the code comes from the following URL: [url=http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm]How to Send Email from a PHP Script Using SMTP Authentication (and SSL Encryption) - About Email, 2nd example. Obviously I have already substituted the email addresses and SMTP server with real ones and not just pasted this into a shell window as is. Shell output from cPanel server: #runuser -l root -c 'php /home/testuser/mailer.php' #

    Message successfully sent!

    runuser -l testuser -c 'php /home/testuser/mailer.php'

    authentication failure [SMTP: Invalid response code received from server (code: 535, response: Incorrect authentication data)]


    Shell output from non cPanel server: #runuser -l root -c 'php /home/testuser/mailer.php' #

    Message successfully sent!

    runuser -l testuser -c 'php /home/testuser/mailer.php'

    Message successfully sent!


    mailer.php [PHP]"; $to = "Ramona Recipient "; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://mail.example.com"; $port = "465"; $username = "smtp_username"; $password = "smtp_password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("

    " . $mail->getMessage() . "

    "); } else { echo("

    Message successfully sent!

    "); } ?>[/PHP]
    0
  • FirstMM
    Just a quick bump. Has anyone else come across this before and found a solution?
    0

Please sign in to leave a comment.