I'm currently in the process of updating my new server to do the same tasks as my original older server (new server is running Debian wheezy, old server is running Debian squeeze).
The issue I'm having is sending email with pear using the following code:
$smtp = Mail::factory('smtp', array ('host' => 'localhost', 'port' => '25', 'auth' => true, 'username' => 'linuxUser', 'password' => 'linuxPassword')); $mail = $smtp->send($to, $headers, $text);
I am able to send emails from the terminal with
However when I attempt to run the php script to send an email via pear I get an error in my mail.log
postfix/smtpd: warning: SASL authentication failure: unable to canonify user and get auxprops postfix/smtpd: warning: localhost[::1] SASL DIGEST-MD5 authentication failed: authentication failure
I'll outline a few of the config files that I've changed
# SMTP Authentication smtpd_sasl_local_domain = $myhostname smtpd_sasl_auth_enable = yes broken_sasl_auth_clients = yes smtp_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains, reject_unauth_destination ... smtpd_banner = mail.$mydomain ESMTP $mail_name mydomain = domain.com myorigin = $mydomain myhostname = mail.domain.com inet_interfaces = all
START=yes MECHANISMS="shadow" OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"
I initially thought that the SASL username & password hadn't been set correctly - most online tutorials show the username & password being stored in a separate DB file. However in my case the user name & password is assigned to a linux username/password.
I've no idea why this is not working, is this a postfix/SMTP error or pear/php error?