3

i have a problem with my mail server (Postfix, Dovecot and MySQL). I can't recieve emails nor send emails with a script that trys to authentificate to a mail-server user account.

I use piwik wich is a script like Google Analytics. I want it to send me a weekly email. In the settings I set the following things:

SMTP server address: domain.tld
SMTP Port: 25
Authentication method for SMTP: Login
SMTP username: stats@domain.tld
SMTP password: *******
SMTP encryption: TLS

Now I try to send the report and I get the following error:

An error occured while sending 'HTML Email Report - 6.2013-04-15.1.en.html' to hello@domain.tld. Error was '5.5.2 : Helo command rejected: need fully-qualified hostname'

My email log says this:

Apr 16 04:22:06 s1 postfix/smtpd[2106]: connect from s1.domain.tld[xx.xxx.xxx.xxx]
Apr 16 04:22:06 s1 postfix/smtpd[2106]: setting up TLS connection from s1.domain.tld[xx.xxx.xxx.xxx]
Apr 16 04:22:06 s1 postfix/smtpd[2106]: Anonymous TLS connection established from s1.domain.tld[xx.xxx.xxx.xxx]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
Apr 16 04:22:06 s1 postfix/smtpd[2106]: NOQUEUE: reject: RCPT from s1.domain.tld[xx.xxx.xxx.xxx]: 504 5.5.2 <localhost>: Helo command rejected: need fully-qualified hostname; from=<noreply@domain.tld> to=<hello@domain.tld> proto=ESMTP helo=<localhost>
Apr 16 04:22:06 s1 postfix/smtpd[2106]: lost connection after RCPT from s1.domain.tld[37.221.195.121]
Apr 16 04:22:06 s1 postfix/smtpd[2106]: disconnect from s1.domain.tld[xx.xxx.xxx.xxx]

Also I can't receive any E-Mails except from big services like iCloud, GMail, Hotmail ect.

If I log in via a mail client like Thunderbird, Mail App or Sparrow everything works fine and the logs also say that there is no error.

in my main.cf file I use the following:

smtpd_tls_auth_only = yes

At the moment I have no idea why I have these problems. I hope someone can help me!

user2284568
  • 31
  • 1
  • 2
  • 5
  • It seems that piwik is not authenticating. you should see a message like: `postfix/smtpd[16156]: .....: client= ... sasl_method=PLAIN, sasl_username=stats@domain.tld` Please post `postconf -n` in your question so that we see the relevant configuration. Also which postfix version are you using. – Sebastian Wiesinger Apr 16 '13 at 08:49
  • I didn't know how to write the entire code into a comment. Here is my output that I get: [click me](https://gist.github.com/anonymous/8d6b626c944eb8bed650) – user2284568 Apr 16 '13 at 12:03

1 Answers1

7

It seems that you restrict EHLO for your authenticated users. Change:

smtpd_helo_restrictions = permit_mynetworks,
    reject_non_fqdn_hostname,
    reject_invalid_hostname,
    permit

to:

smtpd_helo_restrictions = permit_mynetworks,
    permit_sasl_authenticated,
    reject_non_fqdn_hostname,
    reject_invalid_hostname,
    permit
  • 1
    Your reaponse solved my problem. I added it and it finally worked without any problems. Thank you very much for that! – user2284568 Apr 17 '13 at 22:51
  • 1
    This is good. I had HELO restrictions setup this way also, as per the Centos wiki. Adding permit_sasl_authenticated is the solution. – Jimbo Jun 19 '20 at 16:46