11

Hi I have an issue with bounced mail it does not happen all the time but at the same time is very frequent. Most of the time if I send an email to an address that does not exist then i get a bounce back into failues@domain however there seem to be instances when I get this error below

Sep 30 13:38:53 postfix/smtp[62566]: DB8E6D6F9EA: to=, relay=none, delay=0, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for domain loops back to myself)

I seem to get this when I get an immediate bounce i.e the server im trying to connect to immediately blocks the email because it nows that the address does not exist. If the email goes out and is returned later this seems to work fine.

Does anyone have any ideas why I would get this "mail for domain loops back to myself" error message.

Obviously it is me trying to send the email back to myself as my server received a block when trying to send a mail then it tries to send the mail back to the ReplyTo header which in this case is itself but shouldn't it be able to handle this?

........

NOTE: ive had to remove any '.com' from this post as I can only post 1 url

Thanks for the 2 answers already however we are still having the same issue. so below I'm trying to provide some more detailed information.

Both the examples below try to send to a non-existent address. RealTSP bounce from another postfix instance works. Yahoo's bounce doesn't work. We are expecting a "non-delivery notification" to be delivered to , because the Return-Path in both cases is an equivalent VERP address. Note if we don't use VERP, ie "Return-Path: " then yahoo works also.

Log entries

realtsp.....working!
====================
Oct  6 16:46:08 milford postfix/smtpd[58480]: 5027DD6E971: client=takapuna.realtsp[89.187.108.20], sasl_method=LOGIN, sasl_username=*****
Oct  6 16:46:08 milford postfix/cleanup[58482]: 5027DD6E971: message-id=
Oct  6 16:46:08 milford postfix/qmgr[57929]: 5027DD6E971: from=, size=9468, nrcpt=1 (queue active)
Oct  6 16:46:08 milford postfix/smtp[57936]: 5027DD6E971: to=, relay=milford.realtsp[89.187.108.21]:25, delay=0.64, delays=0.63/0/0/0.01, dsn=5.1.1, status\
=bounced (host milford.realtsp[89.187.108.21] said: 550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table (in reply to RCPT TO comm\
and))
Oct  6 16:46:08 milford postfix/bounce[58483]: 5027DD6E971: sender non-delivery notification: EA68FD6EAB7
Oct  6 16:46:08 milford postfix/qmgr[57929]: 5027DD6E971: removed


Oct  6 16:46:08 milford postfix/cleanup[58482]: EA68FD6EAB7: message-id=
Oct  6 16:46:08 milford postfix/qmgr[57929]: EA68FD6EAB7: from=, size=11600, nrcpt=1 (queue active)
Oct  6 16:46:09 milford postfix/lmtp[58484]: EA68FD6EAB7: to=, relay=smtp.news.t1ps[/var/imap/socket/lmtp], delay=0.76, delays=0/0.0\
1/0/0.75, dsn=2.1.5, status=sent (250 2.1.5 Ok)
Oct  6 16:46:09 milford postfix/qmgr[57929]: EA68FD6EAB7: removed


yahoo...not working!
========================
Oct  6 16:42:01 milford postfix/smtpd[57732]: 33EBBD6EE87: client=takapuna.realtsp[89.187.108.20], sasl_method=LOGIN, sasl_username=****
Oct  6 16:42:01 milford postfix/cleanup[57735]: 33EBBD6EE87: message-id=
Oct  6 16:42:01 milford postfix/qmgr[57598]: 33EBBD6EE87: from=, size=9480, nrcpt=1 (queue active)
Oct  6 16:42:10 milford postfix/smtp[57636]: 33EBBD6EE87: to=, relay=e.mx.mail.yahoo[206.190.53.191]:25, delay=9.4, delays=0.02/0/6.5/2.9, dsn=5.0.0, s\
tatus=bounced (host e.mx.mail.yahoo[206.190.53.191] said: 554 delivery error: dd This user doesn't have a yahoo account (nkaderibigbe@yahoo) [0] - mta164.mail.re2.yaho\
o (in reply to end of DATA command))
Oct  6 16:42:10 milford postfix/bounce[57756]: 33EBBD6EE87: sender non-delivery notification: A083ED6EA01
Oct  6 16:42:10 milford postfix/qmgr[57598]: 33EBBD6EE87: removed


Oct  6 16:42:10 milford postfix/cleanup[57735]: A083ED6EA01: message-id=
Oct  6 16:42:10 milford postfix/qmgr[57598]: A083ED6EA01: from=, size=11696, nrcpt=1 (queue active)
Oct  6 16:42:10 milford postfix/smtp[57631]: A083ED6EA01: to=, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.4.6, status=bounced \
(mail for news.t1ps loops back to myself)
Oct  6 16:42:10 milford postfix/qmgr[57598]: A083ED6EA01: removed

main.cf

soft_bounce = no
queue_directory = /var/spool/postfix_rsh
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix_rsh
mail_owner = postfix
myhostname = smtp.news.t1ps
inet_interfaces = 89.187.108.81
local_recipient_maps = $virtual_mailbox_maps
unknown_local_recipient_reject_code = 550
mynetworks_style = host
relay_domains = $mydestination
recipient_delimiter = +

mailbox_transport  = lmtp:unix:/var/imap/socket/lmtp

header_checks = regexp:/usr/local/etc/postfix_rsh/header_checks
debug_peer_level = 10
debug_peer_list = yahoo
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = no
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix_rsh
readme_directory = no
masquerade_domains      = $mydomain
message_size_limit      = 51200000
virtual_transport       = lmtp:unix:/var/imap/socket/lmtp
virtual_mailbox_domains = news.t1ps, domain2, domain3.co.uk, domain4
virtual_alias_maps   = hash:/usr/local/etc/postfix_rsh/virtual
virtual_mailbox_maps = hash:/usr/local/etc/postfix_rsh/virtual_mailbox_maps
transport_maps       = regexp:/usr/local/etc/postfix_rsh/transport
broken_sasl_auth_clients = no
smtp_bind_address               = 89.187.108.81
smtpd_sasl_auth_enable          = yes
smtpd_sender_restrictions       = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_recipient_restrictions    = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_helo_restrictions         = reject_invalid_hostname
smtpd_require_helo              = yes
slow_destination_concurrency_limit = 15
slow_destination_recipient_limit = 5
syslog_facility = local1

/usr/local/etc/postfix_rsh/virtual_mailbox_maps

failures@news.t1ps dummy

master.cf

pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       n       -       500     smtp

slow      unix  -       -       n       -       100     smtp
          -o smtp_connect_timeout=5

relay     unix  -       -       n       -       100     smtp
        -o fallback_relay=
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache

26        inet  n       -       n       -       -       smtpd
         -o content_filter=

smtp      inet  n       -       n       -       -       smtpd
         -o content_filter=spamchk:dummy


spamchk   unix  -       n       n       -       10      pipe
         flags=Rq user=spamd argv=/usr/local/bin/spamchk_rsh -f ${sender} --
         ${recipient}
proxywrite unix -       -       n       -       1       proxymap
Alistair Prestidge
  • 806
  • 1
  • 7
  • 19
  • I would guess that the domain (following the "@") of the return address differs for the two test messages. You appear to have stripped them out, so I can't tell. Are the fully-qualified domain names following the "@" sign in the `to=` field of the logs the same for messages EA68FD6EAB7 and A083ED6EA01? – James Sneeringer Oct 06 '09 at 18:41

3 Answers3

16

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. It's commonly seen in two situations:

  1. You've acquired a new domain that you want to use for email, but you just forgot to add it to Postfix. There are a couple ways to do it. In my case, I'm using the virtual table to map addresses to real local users, so I list my domains in the virtual_alias_domains directive in main.cf.
  2. The domain has its MX record set to a host that resolves to 127.0.0.1. Some malware will use this trick so they can set their return address to a valid domain, which most anti-spam measures will check for. However, the MX effectively prevents any delivery to that address, so the sender doesn't have to deal with replies or bounces.
James Sneeringer
  • 6,755
  • 23
  • 27
3

Given that Postfix tries to deliver a mail to "foo@example.net", the above error happens whenever the MX DNS records (or transport_maps entries) for "example.net" point to the server itself (or the one of the IP addresses specified with proxy_interfaces) , and "example.net" is not recognized as a local domain (not in mydestination, virtual_mailbox_domains or relay_domains - and some very esoteric special cases involving liberal use of virtual_alias_maps and IP literal addressing).

In your case, the message in question is sent from the null sender and the recipient will be the sender of the original mail. That means: Find out why mail for "domain.com" is routed to your Postfix server and why "domain.com" is not recognized as a local address.

Stefan Förster
  • 1,141
  • 5
  • 8
2

Hi just a quick update we found the issue and it had nothing to do with any of the config files that I have posted above it was all to do with the transport config file

we where using regular expression transport matching so we could send via a slow: connection to mail server such as yahoo and hotmail our regular expression was far to relaxed and every time postfix tried to route a bounce it was sending it went and looked in transport found it matched the regular expression and tried to send it to the out side world at this point it found the loop and caused the original error. looking down the regular expression fixed this.

thanks for all your help.

for anyone interested this is now out transport regex:

/@.*hotmail\./       slow:
/@.*live\./          slow:
/@.*msn\./           slow:
/@.*yahoo\./         slow:
/@.*aol\./           slow:
/@.*btinternet\./    slow:
/@.*btopenworld\./   slow:
/@.*talk21\./        slow:

hope this helps any one else that may come across a similar issue.

Alistair Prestidge
  • 806
  • 1
  • 7
  • 19