LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-16-2013, 07:59 AM   #1
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Rep: Reputation: Disabled
Postfix : mail for domain.com loops back to myself


Hello,

I have an postfix with 5 IP and only one domain "domain.com"

When i try to send an email to user@domain.com, i have this error :

Code:
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

<user@domain.com>: mail for domain.com loops back to myself

Final-Recipient: rfc822; user@domain.com
Original-Recipient: rfc822;user@domain.com
Action: failed
Status: 5.4.6
Diagnostic-Code: X-Postfix; mail for domain.com loops back to myself
The postfix conf is :
Code:
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
milter_default_action = accept
mydestination = localhost.$mydomain, localhost, domain.com
mydomain = domain.com
myhostname = domain.com
mynetworks = 127.0.0.1 198.XXX.XX.17 198.XXX.XX.18 198.XXX.XX.66 198.XXX.XX.67 198.XXX.XX.68
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
non_smtpd_milters = $smtpd_milters
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_milters = inet:127.0.0.1:8891
transport_maps = tcp:[127.0.0.1]:2527
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
DNS for my domain.com
Code:
@	IN SOA dns104.ovh.net. tech.ovh.net. (2013051603 86400 3600 3600000 300)
                            IN NS     ns104.ovh.net.
                            IN NS     dns104.ovh.net.
                            IN NS     ns1.domain.com.
                            IN MX 20  domain.com.
                            IN A      198.xxx.xx.18
                            IN A      198.xxx.xx.17
                            IN A      198.xxx.xx.68
                            IN A      198.xxx.xx.66
                            IN A      198.xxx.xx.67
                            IN TXT    "v=spf1 a ptr mx:domain.com -all"
_domainkey.domain.com        IN TXT    "t=y; o=-;".
default._domainkey          IN TXT    "( k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqAp1WvQBqAGqrtwM2dN4TWmTZB1r5yZwQR7YzIcPAZKp/TJJeNJzY3FUPCOT95PbelP/24leKriCvdP85squ5gcSU3Xb7/NpbcS1G5NzUNimUSnoLnfR7DfeTrCabn2UnHOLzv8PflS7TtFiHlQIDAQAB )"
ftp                         IN CNAME  domain.com.
imap                        IN CNAME  domain.com.
mail                        IN MX 10  domain.com.
mail                        IN A      198.xxx.xx.18
mail                        IN A      198.xxx.xx.17
mail                        IN A      198.xxx.xx.68
mail                        IN A      198.xxx.xx.66
mail                        IN A      198.xxx.xx.67
ns1                         IN A      198.xxx.xx.17
pop3                        IN CNAME  domain.com.
smtp                        IN CNAME  domain.com.
www                         IN CNAME  domain.com.
I'm running on centos 6.

Thanks in advance for anyone who has any insight one this.
 
Old 05-16-2013, 08:15 AM   #2
siremaxus
Member
 
Registered: May 2013
Posts: 75

Rep: Reputation: Disabled
Hello,

Do you have any log from file "/var/log/maillog" that could help troubleshoot this problem?

Sire Maxus
 
Old 05-16-2013, 08:18 AM   #3
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
sorry, i forgot it :

Code:
May 16 17:17:00 server1 postfix-rotate5/smtp[28332]: 2BF18240152A: to=<user@domain.com>, relay=none, delay=1.1, delays=0.64/0.01/0.42/0, dsn=5.4.6, status=bounced (mail for domain.com loops back to myself)
May 16 17:17:00 server1 postfix/cleanup[28331]: 0FC7F2402EEA: message-id=<20130516131700.0FC7F2402EEA@domain.com>
May 16 17:17:00 server1 postfix/bounce[28333]: 2BF18240152A: sender non-delivery notification: 0FC7F2402EEA
May 16 17:17:00 server1 postfix/qmgr[28159]: 0FC7F2402EEA: from=<>, size=3735, nrcpt=1 (queue active)
May 16 17:17:00 server1 postfix/randomizer[28330]: Using: 2 Transport Service
May 16 17:17:00 server1 postfix/qmgr[28159]: 2BF18240152A: removed
 
Old 05-16-2013, 08:29 AM   #4
siremaxus
Member
 
Registered: May 2013
Posts: 75

Rep: Reputation: Disabled
Hi,

Thanks, while you were posting the logs I checked and missed the "inet_interfaces" field, did you configure that? how?
That line should be like:
inet_interfaces=all

Good Luck

Sire Maxus
 
Old 05-16-2013, 08:39 AM   #5
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thank you for your help.

I have added "inet_interfaces=all" in main.cf and restart postfix but i have exactly the same error
 
Old 05-16-2013, 09:51 AM   #6
siremaxus
Member
 
Registered: May 2013
Posts: 75

Rep: Reputation: Disabled
Hi,

If "domain.com" is your domain, what do you have when you do this:
#dig -t mx domain.com

then try again to send an email, but post a longer extract from maillog, one that shows the initial connection and the steps taken after that point.

Sire Maxus
 
Old 05-16-2013, 11:13 AM   #7
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
Code:
dig -t mx domain.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> -t mx domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3746
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;domain.com.                     IN      MX

;; ANSWER SECTION:
domain.com.              10800   IN      MX      50 domain.com.

;; Query time: 225 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu May 16 20:06:44 2013
;; MSG SIZE  rcvd: 43
And maillog

Code:
May 16 20:09:09 server1 postfix/smtpd[30089]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 16 20:09:09 server1 postfix/smtpd[30089]: connect from mail-la0-f41.google.com[209.85.215.41]
May 16 20:09:09 server1 postfix/randomizer[30097]: Using: 4 Transport Service
May 16 20:09:09 server1 postfix/randomizer[30097]: Using: 3 Transport Service
May 16 20:09:09 server1 postfix/randomizer[30097]: Using: 1 Transport Service
May 16 20:09:10 server1 postfix/randomizer[30097]: Using: 0 Transport Service
May 16 20:09:10 server1 postfix/smtpd[30089]: 090FA2402D28: client=mail-la0-f41.google.com[209.85.215.41]
May 16 20:09:10 server1 postfix/cleanup[30098]: 090FA2402D28: message-id=<CAHc-r7_pW8+1aWgMXsy4QGEUKvSTanrB9qaqMNk+5ce6mJuQgw@mail.gmail.com>
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: mail-la0-f41.google.com [209.85.215.41] not internal
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: not authenticated
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: DKIM verification successful
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: s=20120113 d=gmail.com SSL
May 16 20:09:10 server1 postfix/qmgr[28742]: 090FA2402D28: from=<mymail@gmail.com>, size=1842, nrcpt=1 (queue active)
May 16 20:09:10 server1 postfix/randomizer[30097]: Using: 0 Transport Service
May 16 20:09:10 server1 postfix/smtpd[30089]: disconnect from mail-la0-f41.google.com[209.85.215.41]
May 16 20:09:10 server1 postfix-rotate1/smtp[30100]: 090FA2402D28: to=<user@domain.com>, relay=none, delay=1.1, delays=0.85/0.01/0.22/0, dsn=5.4.6, status=bounced (mail for domain.com loops back to myself)
May 16 20:09:10 server1 postfix/cleanup[30098]: E3EF12402EEE: message-id=<20130516160910.E3EF12402EEE@domain.com>
May 16 20:09:10 server1 postfix/qmgr[28742]: E3EF12402EEE: from=<>, size=3736, nrcpt=1 (queue active)
May 16 20:09:10 server1 postfix/bounce[30103]: 090FA2402D28: sender non-delivery notification: E3EF12402EEE
May 16 20:09:10 server1 postfix/randomizer[30097]: Using: 2 Transport Service
May 16 20:09:10 server1 postfix/qmgr[28742]: 090FA2402D28: removed
May 16 20:09:12 server1 postfix-rotate3/smtp[30104]: E3EF12402EEE: to=<mymail@gmail.com>, relay=gmail-smtp-in.l.google.com[173.xxx.xx.26]:25, delay=1.6, delays=0.01/0.01/0.68/0.95, dsn=2.0.0, status=sent (250 2.0.0 OK 1368720552 gf3si1919096bkc.200 - gsmtp)
May 16 20:09:12 server1 postfix/qmgr[28742]: E3EF12402EEE: removed
Thanks for your help
 
Old 05-16-2013, 11:39 AM   #8
siremaxus
Member
 
Registered: May 2013
Posts: 75

Rep: Reputation: Disabled
Hi,

It seems that the DNS query through dig does not have enough information, I can't check properly because I can't your server.
Besides, your dig query asks the server 8.8.8.8 and not any of your DNS server 198.X.X.Y.

maybe that's what is causing your problems

Compare the output from this commands:
#dig -t mx domain.com
and
#dig -t mx yahoo.com

Good Luck,

Sire Maxus
 
Old 05-16-2013, 02:20 PM   #9
nbhadauria
LQ Newbie
 
Registered: May 2013
Posts: 3

Rep: Reputation: Disabled
Hi yobogs,

The problem is with your randomizer script. You have to skip your domainname in the script.

Best
Nitin B.
 
Old 05-18-2013, 01:37 PM   #10
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
nbhadauria, It's not working
 
Old 05-18-2013, 02:12 PM   #11
nbhadauria
LQ Newbie
 
Registered: May 2013
Posts: 3

Rep: Reputation: Disabled
Can you share the script you are using..

Quote:
Originally Posted by yobogs View Post
nbhadauria, It's not working
 
Old 05-18-2013, 02:15 PM   #12
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
Yes of course :

Code:
#!/usr/bin/perl -w
# author: Hari Hendaryanto <hari.h -at- csmcom.com>
 
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
 
#
# our transports array, we will define this in master.cf as transport services
#
 
our @array = (
'rotate1:',
'rotate2:',
'rotate3:',
'rotate4:',
'rotate5:'
);
 
#
# Initalize and open syslog.
#
openlog('postfix/randomizer','pid','mail');
 
#
# Autoflush standard output.
#
select STDOUT; $|++;
 
while (<>) {
        chomp;
        # randomizing transports array
        my $random_smtp = int(rand(scalar(@array)));
        if (/^get\s(.+)$/i) {
                print "200 $array[$random_smtp]\n";
                syslog("info","Using: %s Transport Service", $random_smtp);
                next;
        }
 
    print "200 smtp:";
}
Thanks for your help
 
Old 05-18-2013, 02:17 PM   #13
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
Just another information.
When i delete this line in main.cf i have any error, but ip rotation not working :

transport_maps = tcp:[127.0.0.1]:2527
127.0.0.1:2527_time_limit = 3600s
 
Old 05-18-2013, 02:18 PM   #14
nbhadauria
LQ Newbie
 
Registered: May 2013
Posts: 3

Rep: Reputation: Disabled
yes the problem is in the script, edit it here to send mails to local:

if (/^get\s(.+)$/i) {
print "200 $array[$random_smtp]\n";
syslog("info","Using: %s Transport Service", $random_smtp);
next;
}


Quote:
Originally Posted by yobogs View Post
Yes of course :

Code:
#!/usr/bin/perl -w
# author: Hari Hendaryanto <hari.h -at- csmcom.com>
 
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
 
#
# our transports array, we will define this in master.cf as transport services
#
 
our @array = (
'rotate1:',
'rotate2:',
'rotate3:',
'rotate4:',
'rotate5:'
);
 
#
# Initalize and open syslog.
#
openlog('postfix/randomizer','pid','mail');
 
#
# Autoflush standard output.
#
select STDOUT; $|++;
 
while (<>) {
        chomp;
        # randomizing transports array
        my $random_smtp = int(rand(scalar(@array)));
        if (/^get\s(.+)$/i) {
                print "200 $array[$random_smtp]\n";
                syslog("info","Using: %s Transport Service", $random_smtp);
                next;
        }
 
    print "200 smtp:";
}
Thanks for your help
 
Old 05-18-2013, 02:39 PM   #15
yobogs
LQ Newbie
 
Registered: May 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
I'm sorry, I'm not sure I understood what I should do...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix mail for mydomain.com loops back to myself Problem stimpack Linux - Server 1 03-20-2013 06:16 AM
[SOLVED] Postfix as a mail delivery server fails (status bounced loops back to myself) Larry James Linux - Server 8 07-18-2011 06:42 PM
mail loops back to me (MX problem?) OR did not issue MAIL/EXPN/VRFY/ETRN skc Linux - Server 6 07-09-2011 09:18 PM
Postfix mail loops back to myself iceman42 Linux - Server 3 08-03-2010 05:59 AM
postfix virtual hosting problem - mail for domain.com loops back to myself ddaas Linux - Server 4 12-28-2008 08:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration