0

Host cannot send mail over relay host with port 587.

I have two servers. One mail server and one server that uses the mail server as a relay host.

The client server should send over Port 587. A telnet connection is possible between the client and mail server on port 587. But trying to send mail results in the following lines (/var/log/maillog):

May 23 07:16:56 mail postfix/smtpd[15476]: connect from HOST_DNS[HOST_IP]
May 23 07:16:56 mail postfix/smtpd[15476]: disconnect from HOST_DNS[HOST_IP] ehlo=1 auth=0/2 quit=1 commands=2/4

EDIT:

I also get this in maillog:

May 23 09:32:13 187 postfix/smtp[402991]: maps_find: smtp_sasl_password_maps: MYHOSTNAME: not found
May 23 09:32:13 187 postfix/smtp[402991]: maps_find: smtp_sasl_password_maps: [MYHOSTNAME]:587: not found

In main.cf:

relayhost=[MYHOSTNAME]:587

and in /etc/postfix/sasl_passwd:

[MYHOSTNAME]:587 user@domain:password

SOLVED THIS PART: Syntax error in sasl_passwd and missing postmap command. Problem above still exists.

2
  • Does the client authenticate? SMTP/MSA requires authentication.
    – Zac67
    Commented May 23, 2023 at 8:06
  • It was a syntax error in the sasl_passwd file, now the authentication works so i can send a mail with the terminal function mail. But if i will send it over php I still get the errors above.
    – Tom Krebs
    Commented May 23, 2023 at 8:10

1 Answer 1

0

You probably have in addition to

relayhost = [MYHOSTNAME]:587

also enabled authentication to MYHOSTNAME with:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes

The maps_find: error suggests that you did not update the Postfix lookup after updating the plain text file /etc/postfix/sasl_passwd with sudo postmap /etc/postfix/sasl_passwd

8
  • Unfortunately I already set auth enable.
    – Tom Krebs
    Commented May 23, 2023 at 8:43
  • With maps_find you were right, but I still cannot send mails with the php function. I see no errors in the log the connection just does not work...
    – Tom Krebs
    Commented May 23, 2023 at 8:45
  • Is your PHP code configured to use the system mail functionality i.e. /usr/lib/sendmail or is it more sophisticated code that attempts to make SMTP connection ?
    – HBruijn
    Commented May 23, 2023 at 8:48
  • I use the system mail. In my config are entries like: mailpath: /usr/sbin/sendmail smtp_host: myhostname and smtp_port: 587 and my suspicion is that sendmail has problems with port 587, but I cannot figure it out.
    – Tom Krebs
    Commented May 23, 2023 at 8:54
  • I found an error message regarding my sendmail problem. Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first
    – Tom Krebs
    Commented May 23, 2023 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .