1

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

$mail example@email.com 

However when I attempt to run the php script to send an email via pear I get an error in my mail.log

mail.log Error

postfix/smtpd[7835]: warning: SASL authentication failure: unable to canonify user 
and get auxprops
postfix/smtpd[7835]: warning: localhost[::1] SASL DIGEST-MD5 authentication failed: 
authentication failure

I'll outline a few of the config files that I've changed

/etc/postfix/main.cf

# 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

/etc/default/saslauthd

START=yes
MECHANISMS="shadow"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd" 

/etc/postfix/sasl/smtpd.conf

pwcheck_method: 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?

0

I've changed the following configuration file

/etc/postfix/sasl/smtpd.conf

pwcheck_method: saslauthd
mech_list: PLAIN LOGIN

This now allows authentication to work correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.