1

mailq gives me this error:

F2E7B32820F3     3549 Wed Feb 17 12:15:50  "www-data@info"@hivemind.ru
(host mxs.mail.ru[94.100.180.150] said: 421 Problem resolving DNS for domain info"@hivemind.ru (Domain name is syntactically invalid) (in reply to MAIL FROM command))

I see this type of messages generated by the same software (old SMF forum), but i can't find exact piece. Search in internet gives me no results.

Forum software seems to generate message properly:

postcat -vq 0492D3282068
postcat: name_mask: all
postcat: inet_addr_local: configured 2 IPv4 addresses
postcat: inet_addr_local: configured 2 IPv6 addresses
*** ENVELOPE RECORDS maildrop/0492D3282068 ***
message_arrival_time: Sun Feb 21 15:01:55 2016
named_attribute: rewrite_context=local
sender_fullname: www-data
sender: www-data
*** MESSAGE CONTENTS maildrop/0492D3282068 ***
regular_text: To: test@example.com
regular_text: Subject: =?UTF-8?B?0JTQvtCx0YDQviDQv9C+0LbQsNC70L7QstCw0YLRjCDQvdCwINGE0L7RgNGD0LwgUFNZVFJJQkU=?=
regular_text: X-PHP-Originating-Script: 0:Subs-Post.php
regular_text: From: "PSYTRIBE" <info@psytribe.ru>
regular_text: Return-Path: info@psytribe.ru
regular_text: Date: Sun, 21 Feb 2016 12:01:54 -0000
regular_text: X-Mailer: SMF
regular_text: Mime-Version: 1.0
regular_text: Content-Type: multipart/alternative; boundary="SMF-e8a857e57a7c03288f525582f6bdb280"
regular_text: Content-Transfer-Encoding: 7bit

How can i understand where i should look for mistake?

  • 1
    What is the content in /etc/mailname? (If myorigin is set to /etc/mailname in /etc/postfix/main.cf) . What is the value of myhostname in /etc/postfix/main.cf? This could be where info is added as the domain name in the first place – eranga Feb 27 '16 at 15:18
  • /etc/mailname is info@hivemind.ru – Misha Sunseev Feb 28 '16 at 00:01
  • myhostname = hivemind.ru – Misha Sunseev Feb 28 '16 at 00:01
  • Thank you @eranga, problem solved! I read about /etc/mailname and now know, that it should contain host name only. How to mark your answer as solution? – Misha Sunseev Feb 28 '16 at 00:08
  • Sorry that I was late to reply. I just gave you a hint and you followed it. I guess you should add whatever you did as an answer and mark it as the solution. Cheers. – eranga Mar 02 '16 at 10:54

2 Answers2

5

Probably there are three different things going wrong in your setup. Here is my best guess as to what has happened.

  1. The server has never been configured with a FQDN and has only the name info.
  2. An email is generated by the user www-data.
  3. Since no other email address has been specified, it is automatically constructed by combining the username and host name.
  4. The constructed email address at this point is www-data@info, which is incorrect (unless you control the info TLD and have configured an MX record directly on the TLD, which is not the case).
  5. This email address is passed to another piece of software which will accept either a full email address or just a username.
  6. The email address is parsed to decide that it is only a username and not a full email address.
  7. The username is combined with the domain name, which is different from the hostname used by the previous software. Because www-data@info is assumed to be the username and it contains a @ character, it is quoted in accordance with relevant RFCs. This means the email address sent on the wire will look like <"www-data@info"@hivemind.ru>. This is syntactically valid, but probably not what you intended.
  8. The next piece of software parsing this address is buggy and does not parse it according to RFC. It incorrectly believes the first @ separates the local-part from the domain even though the first @ is within quotes.

The three things that went wrong here is that:

  1. At first the domain name info was used rather than the intended domain.
  2. Later some software uses a heuristic to decide whether it has been given a full address or only a local-part, it reaches a different conclusion than was intended by the software that produced that input.
  3. A bug in a parser which doesn't understand quoted-string cause it to incorrectly reject the domain as being invalid.

RFC 2821 recommends against using addresses which require quoting. And your scenario shows why it is sound to recommend against such practice.

While the above definition for Local-part is relatively permissive, for maximum interoperability, a host that expects to receive mail SHOULD avoid defining mailboxes where the Local-part requires (or uses) the Quoted-string form or where the Local-part is case- sensitive.

You didn't actually intend to use quoting in the first place. It only happened due to some misconfigured software earlier in the process. You need to work your way backwards in the data flow to find where info was incorrectly used as domain name in the first place and correct that.

kasperd
  • 29,894
  • 16
  • 72
  • 122
  • Thank you for such good answer. hostname -f gives me hivemind.ru Will look deeper into what was happen. – Misha Sunseev Feb 21 '16 at 14:27
  • Added mail header to original post. – Misha Sunseev Feb 21 '16 at 14:37
  • @MishaSunseev The error message is about the **envelope** from address which does not have to be the same as the address in the from **header**. – kasperd Feb 21 '16 at 16:28
  • This isn't php script causing error, but sendmail or postfix. Is this what you are talking about? – Misha Sunseev Feb 21 '16 at 17:31
  • 1
    @MishaSunseev I am saying it would have to involve at least three separate pieces of software misunderstanding each other to produce the error. I did not state what those three pieces of software would be. You'll have to track it backwards to find where the incorrect email address came from. – kasperd Feb 21 '16 at 19:22
  • Excellent answer. I only have one comment: It's possible that somewhere, something believes that the *domain* is `info@hivemind.ru`, and that whatever is generating the email is inserting `www-data@` before that. It would create the same symptom. – Jenny D Feb 22 '16 at 12:05
  • @JennyD That cannot be ruled out. But then some other explanation is needed for why double quotes are then inserted around `www-data@info`. – kasperd Feb 22 '16 at 13:09
  • 1
    Yes - postfix does not do that by itself (I checked). But it's still worth noting as it affects what @MishaSunseev should search for in his code and config files. – Jenny D Feb 22 '16 at 13:27
  • What is the content in /etc/mailname? (If myorigin is set to /etc/mailname in /etc/postfix/main.cf) . What is the value of myhostname in /etc/postfix/main.cf? This could be where info is added as the domain name in the first place. – eranga Feb 25 '16 at 05:38
  • @eranga On my systems `/etc/mailname` contains just the domain name, and that works. – kasperd Feb 25 '16 at 08:08
  • @kasperd I intended to ask that from OP. Really sorry. I have commented on the wrong post. Should I be removing the comment? – eranga Feb 27 '16 at 15:17
  • That's right, /etc/mailname has info@hivemind.ru instead of hivemind.ru. Now fixed and no mail stuck in mailq! – Misha Sunseev Feb 29 '16 at 21:19
  • I will accept this root answer as it very useful to understand problem. And it contains solution in comments. – Misha Sunseev Feb 29 '16 at 21:21
2

It's not really clear what you're asking, since the error message is pretty clear... The address:

"www-data@info"@hivemind.ru

isn't valid. It's being parsed as username www-data and domain name info"@hivemind.ru but that's not a valid domain name.

There's no way to tell from what you've posted why your SMF software is trying to send to that address.

Ward - Reinstate Monica
  • 12,788
  • 28
  • 44
  • 59
  • 1
    It is syntactically valid, but it is not recommended to use `@` in local-part. RFC 2821 says: **a host that expects to receive mail SHOULD avoid defining mailboxes where the Local-part requires (or uses) the Quoted-string form or where the Local-part is case- sensitive.** The correct way to parse `"www-data@info"@hivemind.ru` as a mail address is to parse `"www-data@info"` as quoted-string and `hivemind.ru` as domain. – kasperd Feb 21 '16 at 11:51
  • It's clear that address is invalid. Can't understand how it was created and can't find exact piece of code that did it. – Misha Sunseev Feb 21 '16 at 14:29