• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

SMTP Authentication Not Working - Does Not Support Authentication

S

Superman859

Guest
I'm working on developing my site on Plesk 8.6.0. I am trying to use the PEAR::Mail() function for PHP. However, I am not able to use authentication.

$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $smtp_username,
'password' => $smtp_password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
//sends me an email using php mail() function instead, includes $mail->getMessage() in the body of mail
}

Above is the main idea of what I am doing with PEAR::Mail. It should all be correct, and all variables are filled in appropriately as far as I know.

The error returned is

authentication failure [SMTP: SMTP server does not support authentication (code: 250, response: {IP ADDRESS}

When I use no authentication as follows, PEAR::Mail works.

$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => false,
'username' => $smtp_username,
'password' => $smtp_password));

Does anyone have any idea what is going on? Does SMTP Authentication not work in Plesk 8.6.0? This seems like quite an issue.

A few notes: Yes - under Server - Mail settings for Plesk I have it set to Authentication is required (SMTP is checked, POP3 locktime text field left blank and also unchecked). I have it set to Only use of full POP3/IMAP mail accounts names is allowed as well. The SMTP username used is one of my usernames (including domain name) I use to login to Horde webmail, along with the appropriate password.

Here are some other results:

[root@IP]# cat /etc/xinetd.d/smtp_psa

service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
env = SMTPAUTH=1
server = /var/qmail/bin/tcp-env
server_args = -Rt0 /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}
 
Normally you don't need to use SMTP authentication when connecting from localhost. Why do you want to use SMTP and authentication at all? It looks like PEAR::Mail also has a PHP mail() function interface and a Sendmail interface, I think I'd use one of those when sending mail via localhost.
 
Solution for your Problem.

The code found in this example should be fairly straightforward, so I won't elaborate on its contents, although it's worth noting that in this particular case PHP's OpenSSL extension must be enabled, because Gmail requires an SSL connection in addition to SMTP authentication. If your server doesn't require SSL, you should be able to authenticate without necessarily reconfiguring PHP to include this extension.
 
I'm guessing that because 127.0.0.1 is whitelisted and allowed to send email by default without authentication, attempting to authenticate is causing the error. But as the others say, why authenticate when you don't need to? I'm not sure I understand?

Faris.
 
Back
Top