HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   ISPConfig 3 Priority Support (http://www.howtoforge.com/forums/forumdisplay.php?f=35)
-   -   PHPMailer Authentication Problem Possibly Caused by ISPConfig 3 Configuration? (http://www.howtoforge.com/forums/showthread.php?t=61772)

darinpeterson 9th May 2013 05:23

PHPMailer Authentication Problem Possibly Caused by ISPConfig 3 Configuration?
 
OS: Debian Squeeze, Dovecot
ISPConfig: v3.0.5.2

I am trying to use PHPMailer to connect to my mail server, and I keep getting the following authentication error:

Code:

SMTP -> ERROR: Password not accepted from server: 535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
Initially I thought this was cause because openssl was not enabled for PHP, but I checked php -i, and it is enabled.

I changed the password several times, and it still will not authenticate. Here's my code, and I have enabled smtpd:

Code:

$mail = new PHPMailer();
        $mail->SMTPDebug = 1;
        $mail->IsSMTP();
        $mail->Host = 'mail.server.tld';
        $mail->Port = 587;
        $mail->Username = 'client@anotherdomain.tld';
        $mail->Password = 'zzzzzz';
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = 'tls';
        $mail->FromName = 'Name';
        $mail->From = 'client@anotherdomain.tld';
        $mail->Subject = $subject;
        $mail->IsHTML(false);
        $mail->Body = $mail_message;
        $mail->AddAddress($to);
        $mail->AddReplyTo($email);
        if (!$mail->Send()) {
            echo "Could not deliver message to: $to.<br/>";
        }

My mail clients use the same information as I placed in the configuration above, and have no problems connecting.

Is there something in ISPConfig 3 that might be preventing me from connecting to the mail server via PHPMailer?

till 9th May 2013 15:24

The autentication mechanism is the same for all mail clients, if the mail account works in your normal email client with same settings (tls) then the problem is not related to ispconfig.

If you run this php script on the sever, you dont need to authenticate, just use localhost as mailserver host.

darinpeterson 9th May 2013 16:23

Thank you for the prompt reply. It's a multi-server setup, so I need to be able to authenticate. I'll keep digging and post when I find a solution.

till 9th May 2013 20:18

Please check if your mail server node has smtps enabled in master.cf file.

darinpeterson 10th May 2013 16:41

Yes.

Code:

smtps    inet  n      -      -      -      -      smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING

I believe the problem is with my PHPMailer install. Thanks for checking on the smtps.

till 11th May 2013 18:01

If scripts that run on the web node shoul slways be able to send trough the mail node, then you can add the ip address of the web node in the mynetworks line in main.cf on the mail node. This will allow scripts from web node to send trough the mail node without needinf smtp authentication.

darinpeterson 5th June 2013 15:53

I tried a couple of different ways of adding my server IP to main.cf, and the only impact has been that email has stopped working.

Code:

mynetworks = 127.0.0.0/8 [::1]/128
I tried

Code:

mynetworks = 127.0.0.0/8 IP/CIDR [::1]/128
Code:

mynetworks = 127.0.0.0/8 [::1]/128 IP/CIDR
Neither worked, and I haven't been able to find good documentation to help me understand what is possible.

Can you please explain how to add the IP correctly?

till 6th June 2013 13:48

Just add the IP. If your IP is e.g.- 192.168.0.1, then the new line in the config file is:

mynetworks = 127.0.0.0/8 [::1]/128 192.168.0.1

darinpeterson 11th June 2013 20:18

Worked perfectly... Thank you!


All times are GMT +2. The time now is 16:24.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.