Я пытаюсь настроить postfix для отправки сообщений smtp с помощью phpmailer на centos 7, размещенной на виртуальной машине Azure .(Firewalld / selinux уже отключен)
Моя проблема в том, что я получаю 'КЛИЕНТ: 503 5.5.1 Ошибка: аутентификация не включена SMTP ERROR' , когда я пытаюсь использовать phpmailer .
2018-06-02 16:07:17 SERVER -> CLIENT: 220 myserver.com ESMTP Postfix 2018-06-02 16:07:17 CLIENT -> SERVER: EHLO myserver.com 2018-06-02 16:07:17 SERVER -> CLIENT: 250-myserver.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN 2018-06-02 16:07:17 CLIENT -> SERVER: AUTH LOGIN 2018-06-02 16:07:17 SERVER -> CLIENT: 503 5.5.1 Error: authentication not enabled 2018-06-02 16:07:17 SMTP ERROR: AUTH command failed: 503 5.5.1 Error: authentication not enabled 2018-06-02 16:07:17 CLIENT -> SERVER: QUIT 2018-06-02 16:07:17 SERVER -> CLIENT: 221 2.0.0 Bye 2018-06-02 16:07:17 SMTP connect() failed. Mailer Error: SMTP connect() failed.
Это мои настройки почты phpmailser.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>PHPMailer - SMTP email test</title>
</head>
<body>
<?php
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->isSMTP();
$host = "localhost";
$username = "captan@myserver.com";
$password = "XUF9?YMd";
$Port = 25;
$mail->FromName = "Mail from rovo ";
$mail->From = "captan@myserver.com";
$mail->Host = $host;
$mail->Port = $Port;
#$mail->SMTPSecure = 'ssl'; //optional
$mail->SMTPAuth = true;
$mail->Username = $username;
$mail->Password = $password;
$mail->AddAddress("mymail@yahoo.com");
$mail->Subject = 'PHPMailer - SMTP email test';
$mail->Body = 'This is a plain-text message body';
$mail->SMTPDebug = 2;
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>
я не могу использовать phpmailer из-за вышеуказанной ошибки, но я могу успешно телнет на порт 25 с сервером
[root@myserver ~]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 myserver.com ESMTP Postfix
postconf -M результаты, подобные этому
smtp inet n - n - - smtpd
465 inet n - n - - smtpd
587 inet n - n - - smtpd
25 inet n - n - - smtpd
submission inet n - - - - smtpd -o syslog_name=postfix/submission -o smtpd_sasl_auth_enable=yes -o milter_macro_daemon_name=ORIGINATING -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
smtps inet n - n - - smtpd -o syslog_name=postfix/smtps -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
postconf -n результаты
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /usr/share/doc/postfix-2.10.1/samples myhostname = myserver.com mydomain = myserver.com myorigin = win home_mailbox = mail/ mynetworks = 127.0.0.0/8 inet_interfaces = all inet_protocols = all inet_interfaces = localhost mydestination = myserver.com, localhost.com, localhost, com smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_local_domain = smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes smtp_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination smtp_tls_security_level = may smtpd_tls_security_level = may smtp_tls_note_starttls_offer = yes smtpd_tls_loglevel = 1 smtpd_tls_key_file = /etc/postfix/ssl/server.key smtpd_tls_cert_file = /etc/postfix/ssl/server.crt smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
Пожалуйста, помогите мне решить эту проблему.поиск и устранение неисправностей в течение нескольких часов, но пока без понятия