0

I had installed and configured dovecot, postfix, and postfixadmin step by step from this tutorial on my server (CentOS6).

I can create virtual mailboxes as well now and can login to roundcubemail, I can also send emails but when I want to send email from other mail systems like gmail, yahoo and etc then I get this error:

This is the mail system at host domain.com.

I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can delete your own text from the attached returned message.

The mail system

<admin@domain.com>: unknown user: "admin"

Final-Recipient: rfc822; admin@domain.com
Original-Recipient: rfc822;admin@domain.com
Action: failed
Status: 5.1.1
Diagnostic-Code: X-Postfix; unknown user: "admin"

This is postfix main.cf:

# network settings
inet_interfaces = all
mydomain = domain.com
myhostname = mail.domain.com
mynetworks = $config_directory/mynetworks
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relay_domains = proxy:mysql:/etc/postfix/mysql-relay_domains_maps.cf

And the mynetworks file:

192.168.0.0/16
10.0.0.0/8
127.0.0.0/8
[::ffff:127.0.0.0]/104
[::1]/128
127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
130.185.0.0/16 # -> my domain ip

And mysql-relay_domains_maps.cf:

hosts = localhost
user = postfix
password = postfixpassword
dbname = postfix
query = SELECT domain FROM domain WHERE domain='%s' and backupmx = '1'

The error showing up in the logs is the following:

postfix/local[19002]: 38902E0550: to=<admin@domain.com>, relay=local, delay=0.09, delays=0.06/0.01/0/0.02, dsn=5.1.1, status=bounced (unknown user: "admin")

After reading some posts and I changed mydestination from this

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

to

mydestination = localhost

but after this change, I the error in the logs change to:

postfix/smtp[18844]: D6EEFE0550: to=<admin@domain.com>, relay=none, delay=0.14, delays=0.05/0.01/0.08/0, dsn=5.4.6, status=bounced (mail for domain.com loops back to myself)
sebix
  • 4,175
  • 2
  • 25
  • 45
sIiiS
  • 101
  • 2
  • 6
  • Please edit the question and add delivery log (i.e. log when postfix reject email) in both conditions, before and after you change `mydestination` parameter – masegaloeh Jul 14 '14 at 07:21
  • log added, please read it – sIiiS Jul 14 '14 at 08:54
  • I doubt you read all the [previous questions containing this error](http://serverfault.com/search?q=[postfix]+mail+for+loops+back+to+myself). I guess from these, that the log is from the `mydestination = localhost` setting, which is apparently false for a public mailserver. To cite from [another answer](http://serverfault.com/a/70005/217116): _This happens when domain.com has an MX record (or, in the absence of an MX, an A record) that points to your Postfix server, but your Postfix server is not configured to accept mail for that domain._ – sebix Jul 14 '14 at 09:18
  • I did every change but none of them helped me till now, maybe some things is wrong here :( – sIiiS Jul 14 '14 at 10:58
  • Please describe the changes you made and your problems **in detail**, not, _simle things are wrong_! You did change `relay_domains`, which is by default `$mydestination`, that lists the domains that are deliverd locally. You have to insert your domains into the MySQL table there, have you done that? – sebix Jul 14 '14 at 11:17
  • if `myhostname = domain.com` and `mydestination = $myhostname, localhost.$mydomain, localhost` then error is `www postfix/local[19002]: 38902E0550: to=, relay=local, delay=0.09, delays=0.06/0.01/0/0.02, dsn=5.1.1, status=bounced (unknown user: "admin")` and if `myhostname = mail.domain.com` and `mydestination = $myhostname, localhost.$mydomain, localhost` then error is `www postfix/smtp[18844]: D6EEFE0550: to=, relay=none, delay=0.14, delays=0.05/0.01/0.08/0, dsn=5.4.6, status=bounced (mail for domain.com loops back to myself)` – sIiiS Jul 14 '14 at 11:35
  • I added domain.com and mail.domain.com to my TABLE database and alises mail.domain.com to domain.com from postfixadmin – sIiiS Jul 14 '14 at 12:36

2 Answers2

0

If I were you, firstly I would backup mail.log then reverted all changes to the state from the tutorial, then I would add to main.cf:

debug_peer_level = 5
debug_peer_list = 127.0.0.1

then blanked mail.log cat /dev/null > /var/log/mail.log restarted postfix and manually connect to postfix (here is only the commands I would input):

telnet 127.0.0.1 25
ehlo 127.0.0.1
mail from: <my_email_at@gmail.com>
rcpt to: <admin@domain.com>
quit

then stopped postfix and analyze the logs. Searched for >>> CHECKING RECIPIENT MAPS <<< and looked below fir any errors.

One more question: only admin isn't working or any address ?

Dawid
  • 186
  • 1
  • 7
  • I do this, and got some log, but can not post here, because I have not enough space for it, but you can see in this link: [error log](http://paste.ubuntu.com/7794121/) and for your Q, all of the address do not work – sIiiS Jul 14 '14 at 16:02
  • This is interesting cause line 44 of that logs (`Jul 14 20:11:36 domain postfix/smtpd[9206]: > localhost[127.0.0.1]: 250 2.1.5 Ok`) says that the lookup was successful so postfix found that user. I think that there is some logic error in the configuration. I would suggest go through config line by line. Gonna try setup using that tutorial, later today.... – Dawid Jul 14 '14 at 17:23
0

Problem solved!

Changed host.domain.com to server.domain.com and problem solved, because mail.domain.com was as MX record in my DNS settings

sIiiS
  • 101
  • 2
  • 6
  • -.- So, you could have (very!) easily solved this problem yourself, by searching for the error message in the internet. – sebix Jul 15 '14 at 17:55