Score:0

Why is my client server unable to send emails over port 587 while a telnet connection to my mail server is possible?

mp flag

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.

Zac67 avatar
ru flag
Does the client authenticate? SMTP/MSA requires authentication.
Tom Krebs avatar
mp flag
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.
Score:0
in flag

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

Tom Krebs avatar
mp flag
Unfortunately I already set auth enable.
Tom Krebs avatar
mp flag
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...
HBruijn avatar
in flag
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 ?
Tom Krebs avatar
mp flag
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 avatar
mp flag
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**
HBruijn avatar
in flag
It looks like you're not allowed to authenticate over a clear text channel ; which makes sense. Add a setting `smtp_use_tls = yes` and you may also need to add `smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt` (with the correct path to where on your system the CA certificate bundle is stored ) answered edited as well to reflect that
Tom Krebs avatar
mp flag
I think thats the actual problem. I activated these settings but it is still not working. Same error. Is it possible that I have to install a diffrent certificate first?
Tom Krebs avatar
mp flag
Thanks, the smtp_tls_CAfile helped to solve the problem.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.