# mail for domain.corp loops back to myself

**URL:** <https://community.ciphermail.com/t/mail-for-domain-corp-loops-back-to-myself/734>\
**Category:** Gateway\
**Created:** [May 15, 2021, 7:38am UTC](https://community.ciphermail.com/t/mail-for-domain-corp-loops-back-to-myself/734 "2021-05-15T07:38:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Hansen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@Jeremy\_Hansen](https://community.ciphermail.com/u/Jeremy_Hansen)\
**Post date:** [May 15, 2021, 7:38am UTC](https://community.ciphermail.com/t/mail-for-domain-corp-loops-back-to-myself/734/1 "2021-05-15T07:38:48Z")

</div>

I’m attempting to evaluate Ciphermail and I’m running info this "mail for domain.corp loops back to myself”

My goal is to set up Ciphermail as an internal mail server just for testing.

So, I have

testmail.mx.domain.corp

domain.corp’s MX record is set to:

dig @192.168.10.10 mx domain.corp

; \<\<\>\> DiG 9.11.13-RedHat-9.11.13-3.el8 \<\<\>\> @192.168.10.10 mx domain.corp  
; (1 server found)  
;; global options: +cmd  
;; Got answer:  
;; -\>\>HEADER\<\<- opcode: QUERY, status: NOERROR, id: 59536  
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:  
; EDNS: version: 0, flags:; udp: 4096  
; COOKIE: 3c201885a57bfe1393fbf7a2609f79469962e84c4c0b267e (good)  
;; QUESTION SECTION:  
;domain.corp. IN MX

;; ANSWER SECTION:  
domain.corp. 300 IN MX 0 testmail.mx.domain.corp.

;; AUTHORITY SECTION:  
domain.corp. 300 IN NS 192.168.10.10.

;; ADDITIONAL SECTION:  
testmail.mx.domain.corp. 300 IN A 192.168.100.20

;; Query time: 1 msec  
;; SERVER: 192.168.10.10#53(192.168.10.10)  
;; WHEN: Sat May 15 00:33:26 PDT 2021  
;; MSG SIZE rcvd: 136

My main.cf looks like this:

# postfix main config for CipherMail

# setting starting with djigzo\_ will be overwritten when applying the MTA settings  
djigzo\_myhostname = testmail.mx.domain.corp  
djigzo\_mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain  
djigzo\_mynetworks = 192.168.10.0/24, 192.168.100.0/24, 127.0.0.0/8  
djigzo\_relayhost =  
djigzo\_relayhost\_mx\_lookup =  
djigzo\_relayhost\_port = 25  
djigzo\_relay\_domains = domain.corp, mx.domain.corp, testmail.mx.domain.corp  
djigzo\_before\_filter\_message\_size\_limit = 10240000  
djigzo\_calculated\_after\_filter\_message\_size\_limit = 30720000  
djigzo\_after\_filter\_message\_size\_limit = ${djigzo\_calculated\_after\_filter\_message\_size\_limit}  
djigzo\_mailbox\_size\_limit = 512000000  
djigzo\_smtp\_helo\_name = testmail.mx.domain.corp  
djigzo\_relay\_transport\_host =  
djigzo\_relay\_transport\_host\_mx\_lookup =  
djigzo\_relay\_transport\_host\_port = 25  
djigzo\_reject\_unverified\_recipient =  
djigzo\_unverified\_recipient\_reject\_code = 450  
djigzo\_parent\_domain\_matches\_subdomains = relay\_domains  
djigzo\_rbl\_clients =  
djigzo\_calculated\_queue\_minfree = 92160000

# The internet hostname of this mail system  
myhostname = ${djigzo\_myhostname}

# The list of domains that are delivered via the $local\_transport mail delivery transport  
mydestination = ${djigzo\_mydestination}

# The list of "trusted" remote SMTP clients that have more privileges than "strangers".  
mynetworks = 127.0.0.0/8, [::1]/128, ${djigzo\_mynetworks}

# What destination domains (and subdomains thereof) this system will relay mail to.  
relay\_domains = ${djigzo\_relay\_domains}

# What Postfix features match subdomains of "domain.tld" automatically, instead of requiring an explicit ".domain.tld" pattern.  
parent\_domain\_matches\_subdomains = ${djigzo\_parent\_domain\_matches\_subdomains}

# The hostname to send in the SMTP EHLO or HELO command.  
smtp\_helo\_name = ${djigzo\_smtp\_helo\_name?$djigzo\_smtp\_helo\_name}${djigzo\_smtp\_helo\_name:${myhostname}}

# The default mail delivery transport and next-hop destination for remote delivery to domains listed with $relay\_domains  
relay\_transport = relay${djigzo\_relay\_transport\_host?:${djigzo\_relay\_transport\_host\_mx\_lookup:[}${djigzo\_relay\_transport\_host}${djigzo\_relay\_transport\_host\_mx\_lookup:]}:${djigzo\_relay\_transport\_host\_port}}

# The next-hop destination of non-local mail  
relayhost = ${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?[}}${djigzo\_relayhost}${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?]}}${djigzo\_relayhost?:${djigzo\_relayhost\_port}}

# Optional restrictions that the Postfix SMTP server applies in the context of a client RCPT TO command  
smtpd\_recipient\_restrictions = permit\_mynetworks reject\_unauth\_destination  
&nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_rbl\_clients}  
&nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_reject\_unverified\_recipient? reject\_unverified\_recipient}

# The numerical Postfix SMTP server response when a recipient address is rejected by the reject\_unverified\_recipient restriction  
unverified\_recipient\_reject\_code = ${djigzo\_unverified\_recipient\_reject\_code}

# disable DSN and ETRN ESMTP announce  
smtpd\_discard\_ehlo\_keywords = silent-discard, dsn, etrn

# reject all ETRN  
smtpd\_etrn\_restrictions = reject

# disable local delivery  
local\_transport = error:local mail delivery is disabled  
local\_recipient\_maps =

# forward local system accounts  
alias\_maps = hash:/etc/aliases  
alias\_database = hash:/etc/aliases  
#virtual\_alias\_maps = hash:/etc/postfix/virtual-aliases

# The maximal size in bytes of a message, including envelope information.  
message\_size\_limit = ${djigzo\_after\_filter\_message\_size\_limit}

# The maximal size of any local(8) individual mailbox or maildir file  
mailbox\_size\_limit = ${djigzo\_mailbox\_size\_limit}

# The minimal amount of free space in bytes in the queue file system that is needed to receive mail  
queue\_minfree = ${djigzo\_calculated\_queue\_minfree}

# What remote SMTP clients are allowed to use the XFORWARD feature  
smtpd\_authorized\_xforward\_hosts = 127.0.0.1/32

# forward incoming email to the Mail Processing Agent (MPA)  
content\_filter = djigzo:[127.0.0.1]:10025

# filter email headers  
#header\_checks = pcre:/etc/postfix/header-checks

# server side TLS configuration  
#smtpd\_tls\_cert\_file = /etc/postfix/tls.pem  
#smtpd\_tls\_key\_file = $smtpd\_tls\_cert\_file  
#smtpd\_tls\_security\_level = may  
#smtpd\_tls\_loglevel = 1  
# disable low grade ciphers to prevent FREAK attack  
#smtpd\_tls\_exclude\_ciphers = aNULL, EXPORT, LOW

# client side TLS configuration  
#smtp\_tls\_CApath = /etc/ssl/certs  
#smtp\_tls\_security\_level = may  
#smtp\_tls\_loglevel = 1

#smtp\_sasl\_auth\_enable = yes  
#smtp\_sasl\_password\_maps = hash:/etc/postfix/smtp\_client\_passwd  
#smtp\_sasl\_type = cyrus  
#smtp\_sasl\_security\_options =

# The mail system name that is displayed in Received: headers, in the SMTP greeting banner, and in bounced mail.  
mail\_name = CipherMail

# The text that follows the 220 status code in the SMTP greeting banner.  
# You MUST specify $myhostname at the start of the text. This is required by the SMTP protocol.  
smtpd\_banner = $myhostname ESMTP $mail\_name

# The time after which the sender receives a copy of the message headers of mail that is still queued.  
# Uncomment the next line to generate "delayed mail" warnings  
#delay\_warning\_time = 4h

# With locally submitted mail, append the string ".$mydomain" to addresses that have no ".domain" information.  
# appending .domain is the MUA's job.  
append\_dot\_mydomain = no

biff = no  
recipient\_delimiter = +

# list of error classes that are reported to the postmaster. Set to empty by default as it can be result in mail floods  
# if there is some Postfix error.  
notify\_classes =

# enable long, non-repeating, queue IDs. The benefit of non-repeating names is simpler logfile analysis  
enable\_long\_queue\_ids = yes

# the address type ("ipv6", "ipv4" or "any") that the Postfix SMTP client will try first, when a destination has  
# IPv6 and IPv4 addresses with equal MX preference.  
smtp\_address\_preference = ipv4

When I send mail from an internal machine:

May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]: connect from macbook-pro.adifferentdomain.intra[192.168.10.95]  
May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]: 4Fhxz26x1wz59DQp: client=macbook-pro.adifferentdomain.intra[192.168.10.95]  
May 15 00:36:14 testmail.mx.domain.corp postfix/cleanup[39461]: 4Fhxz26x1wz59DQp: message-id=\<20210515073614.DB9BED2E9A3(a)macbook-pro.adifferentdomain.intra\>  
May 15 00:36:14 testmail.mx.domain.corp postfix/qmgr[39375]: 4Fhxz26x1wz59DQp: from=\<jeremy(a)macbook-pro.adifferentdomain.intra\>, size=560, nrcpt=1 (queue active)  
May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]: disconnect from macbook-pro.adifferentdomain.intra[192.168.10.95] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5  
May 15 00:36:15 testmail.mx.domain.corp postfix/smtp[39462]: 4Fhxz26x1wz59DQp: to=\<jeremy(a)domain.corp\>, relay=127.0.0.1[127.0.0.1]:10025, delay=0.09, delays=0.01/0/0.04/0.04, dsn=2.6.0, status=sent (250 2.6.0 Message received)  
May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]: 4Fhxz26x1wz59DQp: removed  
May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]: connect from localhost[127.0.0.1]  
May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]: 4Fhxz31K2Fz59DQp: client=localhost[127.0.0.1], orig\_client=macbook-pro.adifferentdomain.intra[192.168.10.95]  
May 15 00:36:15 testmail.mx.domain.corp postfix/cleanup[39464]: 4Fhxz31K2Fz59DQp: message-id=\<20210515073614.DB9BED2E9A3(a)macbook-pro.adifferentdomain.intra\>  
May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]: 4Fhxz31K2Fz59DQp: from=\<jeremy(a)macbook-pro.adifferentdomain.intra\>, size=773, nrcpt=1 (queue active)  
May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]: disconnect from localhost[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 quit=1 commands=6  
May 15 00:36:15 testmail.mx.domain.corp postfix/smtp[39449]: 4Fhxz31K2Fz59DQp: to=\<jeremy(a)domain.corp\>, relay=none, delay=0.02, delays=0.01/0/0.01/0, dsn=5.4.6, status=bounced (mail for domain.corp loops back to myself)  
May 15 00:36:15 testmail.mx.domain.corp postfix/cleanup[39461]: 4Fhxz31TYhz59DR5: message-id=\<4Fhxz31TYhz59DR5(a)testmail.mx.domain.corp\>  
May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]: 4Fhxz31TYhz59DR5: from=\<\>, size=2701, nrcpt=1 (queue active)  
May 15 00:36:15 testmail.mx.domain.corp postfix/bounce[39465]: 4Fhxz31K2Fz59DQp: sender non-delivery notification: 4Fhxz31TYhz59DR5  
May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]: 4Fhxz31K2Fz59DQp: removed  
May 15 00:36:15 testmail.mx.domain.corp postfix/error[39466]: 4Fhxz31TYhz59DR5: to=\<jeremy(a)macbook-pro.adifferentdomain.intra\>, relay=none, delay=0.01, delays=0/0/0/0, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to macbook-pro.adifferentdomain.intra[192.168.10.95]:25: Connection refused)

I’m not sure what I’m doing wrong. I basically want mail to be delivered to the Ciphermail host for user jeremy.

Thanks  
-jeremy

---

<div class="post-metadata">

**Author:** ![martijn](https://dub1.discourse-cdn.com/flex017/user_avatar/community.ciphermail.com/martijn/32/127_2.png) [@martijn](https://community.ciphermail.com/u/martijn)\
**Post date:** [May 17, 2021, 1:21pm UTC](https://community.ciphermail.com/t/mail-for-domain-corp-loops-back-to-myself/734/2 "2021-05-17T13:21:04Z")

</div>

Postfix is responsible for the MTA part. Postfix contains a check which  
checks whether the hostname (fqdn) of the server is the same as the  
hostname of the server it connects to and if so it reports "mail for ... loops back to myself".

since you anonymized the logs, I cannot check whether this is the case  
in your setup. From the config it appears that you did not configure  
"Internal relay host" and therefore MX lookup is done for your internal  
domains. Could it be that you want the CipherMail gateway to first  
receive email for your domain and then have it forward using MX lookups  
to the final server? If so, since the MX records point to the  
CipherMail gateway, it will connect to itself because it will lookup  
the next server via MX lookup.

You can solve this by explicitly specifying the "Internal relay host"  
or by telling the gateway what the external IP address (See  
proxy\_interfaces  
[Postfix Configuration Parameters](http://www.postfix.org/postconf.5.html#proxy_interfaces))

Kind regards,

Martijn Brinkers

> **···**
>
> --  
> CipherMail email encryption  
> Email encryption with support for S/MIME,  
> OpenPGP, PDF Messenger and Webmail Messenger
> 
> On Sat, 2021-05-15 at 00:38 -0700, Jeremy Hansen via Users wrote:
> 
> > I’m attempting to evaluate Ciphermail and I’m running info this "mail  
> > for domain.corp loops back to myself”
> > 
> > My goal is to set up Ciphermail as an internal mail server just for  
> > testing.
> > 
> > So, I have
> > 
> > testmail.mx.domain.corp
> > 
> > domain.corp’s MX record is set to:
> > 
> > dig @192.168.10.10 mx domain.corp
> > 
> > ; \<\<\>\> DiG 9.11.13-RedHat-9.11.13-3.el8 \<\<\>\> @192.168.10.10 mx  
> > domain.corp  
> > ; (1 server found)  
> > ;; global options: +cmd  
> > ;; Got answer:  
> > ;; -\>\>HEADER\<\<- opcode: QUERY, status: NOERROR, id: 59536  
> > ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL:  
> > 2
> > 
> > ;; OPT PSEUDOSECTION:  
> > ; EDNS: version: 0, flags:; udp: 4096  
> > ; COOKIE: 3c201885a57bfe1393fbf7a2609f79469962e84c4c0b267e (good)  
> > ;; QUESTION SECTION:  
> > ;domain.corp. IN MX
> > 
> > ;; ANSWER SECTION:  
> > domain.corp. 300 IN MX 0  
> > testmail.mx.domain.corp.
> > 
> > ;; AUTHORITY SECTION:  
> > domain.corp. 300 IN NS 192.168.10.10.
> > 
> > ;; ADDITIONAL SECTION:  
> > testmail.mx.domain.corp. 300 IN A 192.168.100.2  
> > 0
> > 
> > ;; Query time: 1 msec  
> > ;; SERVER: 192.168.10.10#53(192.168.10.10)  
> > ;; WHEN: Sat May 15 00:33:26 PDT 2021  
> > ;; MSG SIZE rcvd: 136
> > 
> > My main.cf looks like this:
> > 
> > # postfix main config for CipherMail
> > 
> > # setting starting with djigzo\_ will be overwritten when applying the  
> > MTA settings  
> > djigzo\_myhostname = testmail.mx.domain.corp  
> > djigzo\_mydestination = $myhostname, localhost.$mydomain, localhost,  
> > $mydomain  
> > djigzo\_mynetworks = 192.168.10.0/24, 192.168.100.0/24, 127.0.0.0/8  
> > djigzo\_relayhost =  
> > djigzo\_relayhost\_mx\_lookup =  
> > djigzo\_relayhost\_port = 25  
> > djigzo\_relay\_domains = domain.corp, mx.domain.corp,  
> > testmail.mx.domain.corp  
> > djigzo\_before\_filter\_message\_size\_limit = 10240000  
> > djigzo\_calculated\_after\_filter\_message\_size\_limit = 30720000  
> > djigzo\_after\_filter\_message\_size\_limit =  
> > ${djigzo\_calculated\_after\_filter\_message\_size\_limit}  
> > djigzo\_mailbox\_size\_limit = 512000000  
> > djigzo\_smtp\_helo\_name = testmail.mx.domain.corp  
> > djigzo\_relay\_transport\_host =  
> > djigzo\_relay\_transport\_host\_mx\_lookup =  
> > djigzo\_relay\_transport\_host\_port = 25  
> > djigzo\_reject\_unverified\_recipient =  
> > djigzo\_unverified\_recipient\_reject\_code = 450  
> > djigzo\_parent\_domain\_matches\_subdomains = relay\_domains  
> > djigzo\_rbl\_clients =  
> > djigzo\_calculated\_queue\_minfree = 92160000
> > 
> > # The internet hostname of this mail system  
> > myhostname = ${djigzo\_myhostname}
> > 
> > # The list of domains that are delivered via the $local\_transport  
> > mail delivery transport  
> > mydestination = ${djigzo\_mydestination}
> > 
> > # The list of "trusted" remote SMTP clients that have more privileges  
> > than "strangers".  
> > mynetworks = 127.0.0.0/8, [::1]/128, ${djigzo\_mynetworks}
> > 
> > # What destination domains (and subdomains thereof) this system will  
> > relay mail to.  
> > relay\_domains = ${djigzo\_relay\_domains}
> > 
> > # What Postfix features match subdomains of "domain.tld"  
> > automatically, instead of requiring an explicit ".domain.tld"  
> > pattern.  
> > parent\_domain\_matches\_subdomains =  
> > ${djigzo\_parent\_domain\_matches\_subdomains}
> > 
> > # The hostname to send in the SMTP EHLO or HELO command.  
> > smtp\_helo\_name =  
> > ${djigzo\_smtp\_helo\_name?$djigzo\_smtp\_helo\_name}${djigzo\_smtp\_helo\_nam  
> > e:${myhostname}}
> > 
> > # The default mail delivery transport and next-hop destination for  
> > remote delivery to domains listed with $relay\_domains  
> > relay\_transport =  
> > relay${djigzo\_relay\_transport\_host?:${djigzo\_relay\_transport\_host\_mx\_  
> > lookup:[}${djigzo\_relay\_transport\_host}${djigzo\_relay\_transport\_host\_  
> > mx\_lookup:]}:${djigzo\_relay\_transport\_host\_port}}
> > 
> > # The next-hop destination of non-local mail  
> > relayhost =  
> > ${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?[}}${djigzo\_relayhost  
> > }${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?]}}${djigzo\_relayhos  
> > t?:${djigzo\_relayhost\_port}}
> > 
> > # Optional restrictions that the Postfix SMTP server applies in the  
> > context of a client RCPT TO command  
> > smtpd\_recipient\_restrictions = permit\_mynetworks  
> > reject\_unauth\_destination  
> > &nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_rbl\_clients}  
> > &nbsp;&nbsp;&nbsp;&nbsp;${djigzo\_reject\_unverified\_recipient?  
> > reject\_unverified\_recipient}
> > 
> > # The numerical Postfix SMTP server response when a recipient address  
> > is rejected by the reject\_unverified\_recipient restriction  
> > unverified\_recipient\_reject\_code =  
> > ${djigzo\_unverified\_recipient\_reject\_code}
> > 
> > # disable DSN and ETRN ESMTP announce  
> > smtpd\_discard\_ehlo\_keywords = silent-discard, dsn, etrn
> > 
> > # reject all ETRN  
> > smtpd\_etrn\_restrictions = reject
> > 
> > # disable local delivery  
> > local\_transport = error:local mail delivery is disabled  
> > local\_recipient\_maps =
> > 
> > # forward local system accounts  
> > alias\_maps = hash:/etc/aliases  
> > alias\_database = hash:/etc/aliases  
> > #virtual\_alias\_maps = hash:/etc/postfix/virtual-aliases
> > 
> > # The maximal size in bytes of a message, including envelope  
> > information.  
> > message\_size\_limit = ${djigzo\_after\_filter\_message\_size\_limit}
> > 
> > # The maximal size of any local(8) individual mailbox or maildir file  
> > mailbox\_size\_limit = ${djigzo\_mailbox\_size\_limit}
> > 
> > # The minimal amount of free space in bytes in the queue file system  
> > that is needed to receive mail  
> > queue\_minfree = ${djigzo\_calculated\_queue\_minfree}
> > 
> > # What remote SMTP clients are allowed to use the XFORWARD feature  
> > smtpd\_authorized\_xforward\_hosts = 127.0.0.1/32
> > 
> > # forward incoming email to the Mail Processing Agent (MPA)  
> > content\_filter = djigzo:[127.0.0.1]:10025
> > 
> > # filter email headers  
> > #header\_checks = pcre:/etc/postfix/header-checks
> > 
> > # server side TLS configuration  
> > #smtpd\_tls\_cert\_file = /etc/postfix/tls.pem  
> > #smtpd\_tls\_key\_file = $smtpd\_tls\_cert\_file  
> > #smtpd\_tls\_security\_level = may  
> > #smtpd\_tls\_loglevel = 1  
> > # disable low grade ciphers to prevent FREAK attack  
> > #smtpd\_tls\_exclude\_ciphers = aNULL, EXPORT, LOW
> > 
> > # client side TLS configuration  
> > #smtp\_tls\_CApath = /etc/ssl/certs  
> > #smtp\_tls\_security\_level = may  
> > #smtp\_tls\_loglevel = 1
> > 
> > #smtp\_sasl\_auth\_enable = yes  
> > #smtp\_sasl\_password\_maps = hash:/etc/postfix/smtp\_client\_passwd  
> > #smtp\_sasl\_type = cyrus  
> > #smtp\_sasl\_security\_options =
> > 
> > # The mail system name that is displayed in Received: headers, in the  
> > SMTP greeting banner, and in bounced mail.  
> > mail\_name = CipherMail
> > 
> > # The text that follows the 220 status code in the SMTP greeting  
> > banner.  
> > # You MUST specify $myhostname at the start of the text. This is  
> > required by the SMTP protocol.  
> > smtpd\_banner = $myhostname ESMTP $mail\_name
> > 
> > # The time after which the sender receives a copy of the message  
> > headers of mail that is still queued.  
> > # Uncomment the next line to generate "delayed mail" warnings  
> > #delay\_warning\_time = 4h
> > 
> > # With locally submitted mail, append the string ".$mydomain" to  
> > addresses that have no ".domain" information.  
> > # appending .domain is the MUA's job.  
> > append\_dot\_mydomain = no
> > 
> > biff = no  
> > recipient\_delimiter = +
> > 
> > # list of error classes that are reported to the postmaster. Set to  
> > empty by default as it can be result in mail floods  
> > # if there is some Postfix error.  
> > notify\_classes =
> > 
> > # enable long, non-repeating, queue IDs. The benefit of non-repeating  
> > names is simpler logfile analysis  
> > enable\_long\_queue\_ids = yes
> > 
> > # the address type ("ipv6", "ipv4" or "any") that the Postfix SMTP  
> > client will try first, when a destination has  
> > # IPv6 and IPv4 addresses with equal MX preference.  
> > smtp\_address\_preference = ipv4
> > 
> > When I send mail from an internal machine:
> > 
> > May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]: connect  
> > from macbook-pro.adifferentdomain.intra[192.168.10.95]  
> > May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]:  
> > 4Fhxz26x1wz59DQp: client=macbook-  
> > pro.adifferentdomain.intra[192.168.10.95]  
> > May 15 00:36:14 testmail.mx.domain.corp postfix/cleanup[39461]:  
> > 4Fhxz26x1wz59DQp: message-id=\<  
> > 20210515073614.DB9BED2E9A3(a)macbook-pro.adifferentdomain.intra\>  
> > May 15 00:36:14 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > 4Fhxz26x1wz59DQp: from=\<jeremy(a)macbook-pro.adifferentdomain.intra\>,  
> > size=560, nrcpt=1 (queue active)  
> > May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]:  
> > disconnect from macbook-pro.adifferentdomain.intra[192.168.10.95]  
> > ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/smtp[39462]:  
> > 4Fhxz26x1wz59DQp: to=\<jeremy(a)domain.corp\>,  
> > relay=127.0.0.1[127.0.0.1]:10025, delay=0.09,  
> > delays=0.01/0/0.04/0.04, dsn=2.6.0, status=sent (250 2.6.0 Message  
> > received)  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > 4Fhxz26x1wz59DQp: removed  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]: connect  
> > from localhost[127.0.0.1]  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]:  
> > 4Fhxz31K2Fz59DQp: client=localhost[127.0.0.1], orig\_client=macbook-  
> > pro.adifferentdomain.intra[192.168.10.95]  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/cleanup[39464]:  
> > 4Fhxz31K2Fz59DQp: message-id=\<  
> > 20210515073614.DB9BED2E9A3(a)macbook-pro.adifferentdomain.intra\>  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > 4Fhxz31K2Fz59DQp: from=\<jeremy(a)macbook-pro.adifferentdomain.intra\>,  
> > size=773, nrcpt=1 (queue active)  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]:  
> > disconnect from localhost[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1  
> > data=1 quit=1 commands=6  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/smtp[39449]:  
> > 4Fhxz31K2Fz59DQp: to=\<jeremy(a)domain.corp\>, relay=none, delay=0.02,  
> > delays=0.01/0/0.01/0, dsn=5.4.6, status=bounced (mail for domain.corp  
> > loops back to myself)  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/cleanup[39461]:  
> > 4Fhxz31TYhz59DR5: message-id=\<  
> > 4Fhxz31TYhz59DR5(a)testmail.mx.domain.corp\>  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > 4Fhxz31TYhz59DR5: from=\<\>, size=2701, nrcpt=1 (queue active)  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/bounce[39465]:  
> > 4Fhxz31K2Fz59DQp: sender non-delivery notification: 4Fhxz31TYhz59DR5  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > 4Fhxz31K2Fz59DQp: removed  
> > May 15 00:36:15 testmail.mx.domain.corp postfix/error[39466]:  
> > 4Fhxz31TYhz59DR5: to=\<jeremy(a)macbook-pro.adifferentdomain.intra\>,  
> > relay=none, delay=0.01, delays=0/0/0/0, dsn=4.4.1, status=deferred  
> > (delivery temporarily suspended: connect to macbook-  
> > pro.adifferentdomain.intra[192.168.10.95]:25: Connection refused)
> > 
> > I’m not sure what I’m doing wrong. I basically want mail to be  
> > delivered to the Ciphermail host for user jeremy.
> > 
> > Thanks  
> > -jeremy

---

<div class="post-metadata">

**Author:** ![Jeremy\_Hansen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@Jeremy\_Hansen](https://community.ciphermail.com/u/Jeremy_Hansen)\
**Post date:** [May 17, 2021, 8:18pm UTC](https://community.ciphermail.com/t/mail-for-domain-corp-loops-back-to-myself/734/3 "2021-05-17T20:18:50Z")

</div>

Thank you for the response.

The MX is set to the gateway’s address. I don’t want to relay mail. I want to gateway to be the destination and I want \<user(a)domain.corp\> to be delivered to \<user\> on the ciphermail gateway.

It works fine if I set up the relay to go to another MTA, but I was hoping to not relay at all.

Thanks

> **···**
>
> > On May 17, 2021, at 6:21 AM, Martijn Brinkers \<martijn(a)ciphermail.com\> wrote:
> > 
> > Postfix is responsible for the MTA part. Postfix contains a check which  
> > checks whether the hostname (fqdn) of the server is the same as the  
> > hostname of the server it connects to and if so it reports "mail for ... loops back to myself".
> > 
> > since you anonymized the logs, I cannot check whether this is the case  
> > in your setup. From the config it appears that you did not configure  
> > "Internal relay host" and therefore MX lookup is done for your internal  
> > domains. Could it be that you want the CipherMail gateway to first  
> > receive email for your domain and then have it forward using MX lookups  
> > to the final server? If so, since the MX records point to the  
> > CipherMail gateway, it will connect to itself because it will lookup  
> > the next server via MX lookup.
> > 
> > You can solve this by explicitly specifying the "Internal relay host"  
> > or by telling the gateway what the external IP address (See  
> > proxy\_interfaces  
> > [Postfix Configuration Parameters](http://www.postfix.org/postconf.5.html#proxy_interfaces))
> > 
> > Kind regards,
> > 
> > Martijn Brinkers
> > 
> > --  
> > CipherMail email encryption  
> > Email encryption with support for S/MIME,  
> > OpenPGP, PDF Messenger and Webmail Messenger
> > 
> > > On Sat, 2021-05-15 at 00:38 -0700, Jeremy Hansen via Users wrote:  
> > > I’m attempting to evaluate Ciphermail and I’m running info this "mail  
> > > for domain.corp loops back to myself”
> > > 
> > > My goal is to set up Ciphermail as an internal mail server just for  
> > > testing.
> > > 
> > > So, I have
> > > 
> > > testmail.mx.domain.corp
> > > 
> > > domain.corp’s MX record is set to:
> > > 
> > > dig @192.168.10.10 mx domain.corp
> > > 
> > > ; \<\<\>\> DiG 9.11.13-RedHat-9.11.13-3.el8 \<\<\>\> @192.168.10.10 mx  
> > > domain.corp  
> > > ; (1 server found)  
> > > ;; global options: +cmd  
> > > ;; Got answer:  
> > > ;; -\>\>HEADER\<\<- opcode: QUERY, status: NOERROR, id: 59536  
> > > ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL:  
> > > 2
> > > 
> > > ;; OPT PSEUDOSECTION:  
> > > ; EDNS: version: 0, flags:; udp: 4096  
> > > ; COOKIE: 3c201885a57bfe1393fbf7a2609f79469962e84c4c0b267e (good)  
> > > ;; QUESTION SECTION:  
> > > ;domain.corp. IN MX
> > > 
> > > ;; ANSWER SECTION:  
> > > domain.corp. 300 IN MX 0  
> > > testmail.mx.domain.corp.
> > > 
> > > ;; AUTHORITY SECTION:  
> > > domain.corp. 300 IN NS 192.168.10.10.
> > > 
> > > ;; ADDITIONAL SECTION:  
> > > testmail.mx.domain.corp. 300 IN A 192.168.100.2  
> > > 0
> > > 
> > > ;; Query time: 1 msec  
> > > ;; SERVER: 192.168.10.10#53(192.168.10.10)  
> > > ;; WHEN: Sat May 15 00:33:26 PDT 2021  
> > > ;; MSG SIZE rcvd: 136
> > > 
> > > My main.cf looks like this:
> > > 
> > > # postfix main config for CipherMail
> > > 
> > > # setting starting with djigzo\_ will be overwritten when applying the  
> > > MTA settings  
> > > djigzo\_myhostname = testmail.mx.domain.corp  
> > > djigzo\_mydestination = $myhostname, localhost.$mydomain, localhost,  
> > > $mydomain  
> > > djigzo\_mynetworks = 192.168.10.0/24, 192.168.100.0/24, 127.0.0.0/8  
> > > djigzo\_relayhost =  
> > > djigzo\_relayhost\_mx\_lookup =  
> > > djigzo\_relayhost\_port = 25  
> > > djigzo\_relay\_domains = domain.corp, mx.domain.corp,  
> > > testmail.mx.domain.corp  
> > > djigzo\_before\_filter\_message\_size\_limit = 10240000  
> > > djigzo\_calculated\_after\_filter\_message\_size\_limit = 30720000  
> > > djigzo\_after\_filter\_message\_size\_limit =  
> > > ${djigzo\_calculated\_after\_filter\_message\_size\_limit}  
> > > djigzo\_mailbox\_size\_limit = 512000000  
> > > djigzo\_smtp\_helo\_name = testmail.mx.domain.corp  
> > > djigzo\_relay\_transport\_host =  
> > > djigzo\_relay\_transport\_host\_mx\_lookup =  
> > > djigzo\_relay\_transport\_host\_port = 25  
> > > djigzo\_reject\_unverified\_recipient =  
> > > djigzo\_unverified\_recipient\_reject\_code = 450  
> > > djigzo\_parent\_domain\_matches\_subdomains = relay\_domains  
> > > djigzo\_rbl\_clients =  
> > > djigzo\_calculated\_queue\_minfree = 92160000
> > > 
> > > # The internet hostname of this mail system  
> > > myhostname = ${djigzo\_myhostname}
> > > 
> > > # The list of domains that are delivered via the $local\_transport  
> > > mail delivery transport  
> > > mydestination = ${djigzo\_mydestination}
> > > 
> > > # The list of "trusted" remote SMTP clients that have more privileges  
> > > than "strangers".  
> > > mynetworks = 127.0.0.0/8, [::1]/128, ${djigzo\_mynetworks}
> > > 
> > > # What destination domains (and subdomains thereof) this system will  
> > > relay mail to.  
> > > relay\_domains = ${djigzo\_relay\_domains}
> > > 
> > > # What Postfix features match subdomains of "domain.tld"  
> > > automatically, instead of requiring an explicit ".domain.tld"  
> > > pattern.  
> > > parent\_domain\_matches\_subdomains =  
> > > ${djigzo\_parent\_domain\_matches\_subdomains}
> > > 
> > > # The hostname to send in the SMTP EHLO or HELO command.  
> > > smtp\_helo\_name =  
> > > ${djigzo\_smtp\_helo\_name?$djigzo\_smtp\_helo\_name}${djigzo\_smtp\_helo\_nam  
> > > e:${myhostname}}
> > > 
> > > # The default mail delivery transport and next-hop destination for  
> > > remote delivery to domains listed with $relay\_domains  
> > > relay\_transport =  
> > > relay${djigzo\_relay\_transport\_host?:${djigzo\_relay\_transport\_host\_mx\_  
> > > lookup:[}${djigzo\_relay\_transport\_host}${djigzo\_relay\_transport\_host\_  
> > > mx\_lookup:]}:${djigzo\_relay\_transport\_host\_port}}
> > > 
> > > # The next-hop destination of non-local mail  
> > > relayhost =  
> > > ${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?[}}${djigzo\_relayhost  
> > > }${djigzo\_relayhost\_mx\_lookup:${djigzo\_relayhost?]}}${djigzo\_relayhos  
> > > t?:${djigzo\_relayhost\_port}}
> > > 
> > > # Optional restrictions that the Postfix SMTP server applies in the  
> > > context of a client RCPT TO command  
> > > smtpd\_recipient\_restrictions = permit\_mynetworks  
> > > reject\_unauth\_destination  
> > > &nbsp;&nbsp;&nbsp;${djigzo\_rbl\_clients}  
> > > &nbsp;&nbsp;&nbsp;${djigzo\_reject\_unverified\_recipient?  
> > > reject\_unverified\_recipient}
> > > 
> > > # The numerical Postfix SMTP server response when a recipient address  
> > > is rejected by the reject\_unverified\_recipient restriction  
> > > unverified\_recipient\_reject\_code =  
> > > ${djigzo\_unverified\_recipient\_reject\_code}
> > > 
> > > # disable DSN and ETRN ESMTP announce  
> > > smtpd\_discard\_ehlo\_keywords = silent-discard, dsn, etrn
> > > 
> > > # reject all ETRN  
> > > smtpd\_etrn\_restrictions = reject
> > > 
> > > # disable local delivery  
> > > local\_transport = error:local mail delivery is disabled  
> > > local\_recipient\_maps =
> > > 
> > > # forward local system accounts  
> > > alias\_maps = hash:/etc/aliases  
> > > alias\_database = hash:/etc/aliases  
> > > #virtual\_alias\_maps = hash:/etc/postfix/virtual-aliases
> > > 
> > > # The maximal size in bytes of a message, including envelope  
> > > information.  
> > > message\_size\_limit = ${djigzo\_after\_filter\_message\_size\_limit}
> > > 
> > > # The maximal size of any local(8) individual mailbox or maildir file  
> > > mailbox\_size\_limit = ${djigzo\_mailbox\_size\_limit}
> > > 
> > > # The minimal amount of free space in bytes in the queue file system  
> > > that is needed to receive mail  
> > > queue\_minfree = ${djigzo\_calculated\_queue\_minfree}
> > > 
> > > # What remote SMTP clients are allowed to use the XFORWARD feature  
> > > smtpd\_authorized\_xforward\_hosts = 127.0.0.1/32
> > > 
> > > # forward incoming email to the Mail Processing Agent (MPA)  
> > > content\_filter = djigzo:[127.0.0.1]:10025
> > > 
> > > # filter email headers  
> > > #header\_checks = pcre:/etc/postfix/header-checks
> > > 
> > > # server side TLS configuration  
> > > #smtpd\_tls\_cert\_file = /etc/postfix/tls.pem  
> > > #smtpd\_tls\_key\_file = $smtpd\_tls\_cert\_file  
> > > #smtpd\_tls\_security\_level = may  
> > > #smtpd\_tls\_loglevel = 1  
> > > # disable low grade ciphers to prevent FREAK attack  
> > > #smtpd\_tls\_exclude\_ciphers = aNULL, EXPORT, LOW
> > > 
> > > # client side TLS configuration  
> > > #smtp\_tls\_CApath = /etc/ssl/certs  
> > > #smtp\_tls\_security\_level = may  
> > > #smtp\_tls\_loglevel = 1
> > > 
> > > #smtp\_sasl\_auth\_enable = yes  
> > > #smtp\_sasl\_password\_maps = hash:/etc/postfix/smtp\_client\_passwd  
> > > #smtp\_sasl\_type = cyrus  
> > > #smtp\_sasl\_security\_options =
> > > 
> > > # The mail system name that is displayed in Received: headers, in the  
> > > SMTP greeting banner, and in bounced mail.  
> > > mail\_name = CipherMail
> > > 
> > > # The text that follows the 220 status code in the SMTP greeting  
> > > banner.  
> > > # You MUST specify $myhostname at the start of the text. This is  
> > > required by the SMTP protocol.  
> > > smtpd\_banner = $myhostname ESMTP $mail\_name
> > > 
> > > # The time after which the sender receives a copy of the message  
> > > headers of mail that is still queued.  
> > > # Uncomment the next line to generate "delayed mail" warnings  
> > > #delay\_warning\_time = 4h
> > > 
> > > # With locally submitted mail, append the string ".$mydomain" to  
> > > addresses that have no ".domain" information.  
> > > # appending .domain is the MUA's job.  
> > > append\_dot\_mydomain = no
> > > 
> > > biff = no  
> > > recipient\_delimiter = +
> > > 
> > > # list of error classes that are reported to the postmaster. Set to  
> > > empty by default as it can be result in mail floods  
> > > # if there is some Postfix error.  
> > > notify\_classes =
> > > 
> > > # enable long, non-repeating, queue IDs. The benefit of non-repeating  
> > > names is simpler logfile analysis  
> > > enable\_long\_queue\_ids = yes
> > > 
> > > # the address type ("ipv6", "ipv4" or "any") that the Postfix SMTP  
> > > client will try first, when a destination has  
> > > # IPv6 and IPv4 addresses with equal MX preference.  
> > > smtp\_address\_preference = ipv4
> > > 
> > > When I send mail from an internal machine:
> > > 
> > > May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]: connect  
> > > from macbook-pro.adifferentdomain.intra[192.168.10.95]  
> > > May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]:  
> > > 4Fhxz26x1wz59DQp: client=macbook-  
> > > pro.adifferentdomain.intra[192.168.10.95]  
> > > May 15 00:36:14 testmail.mx.domain.corp postfix/cleanup[39461]:  
> > > 4Fhxz26x1wz59DQp: message-id=\<  
> > > 20210515073614.DB9BED2E9A3(a)macbook-pro.adifferentdomain.intra\>  
> > > May 15 00:36:14 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > > 4Fhxz26x1wz59DQp: from=\<jeremy(a)macbook-pro.adifferentdomain.intra\>,  
> > > size=560, nrcpt=1 (queue active)  
> > > May 15 00:36:14 testmail.mx.domain.corp postfix/smtpd[39460]:  
> > > disconnect from macbook-pro.adifferentdomain.intra[192.168.10.95]  
> > > ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/smtp[39462]:  
> > > 4Fhxz26x1wz59DQp: to=\<jeremy(a)domain.corp\>,  
> > > relay=127.0.0.1[127.0.0.1]:10025, delay=0.09,  
> > > delays=0.01/0/0.04/0.04, dsn=2.6.0, status=sent (250 2.6.0 Message  
> > > received)  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > > 4Fhxz26x1wz59DQp: removed  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]: connect  
> > > from localhost[127.0.0.1]  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]:  
> > > 4Fhxz31K2Fz59DQp: client=localhost[127.0.0.1], orig\_client=macbook-  
> > > pro.adifferentdomain.intra[192.168.10.95]  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/cleanup[39464]:  
> > > 4Fhxz31K2Fz59DQp: message-id=\<  
> > > 20210515073614.DB9BED2E9A3(a)macbook-pro.adifferentdomain.intra\>  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > > 4Fhxz31K2Fz59DQp: from=\<jeremy(a)macbook-pro.adifferentdomain.intra\>,  
> > > size=773, nrcpt=1 (queue active)  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/smtpd[39463]:  
> > > disconnect from localhost[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1  
> > > data=1 quit=1 commands=6  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/smtp[39449]:  
> > > 4Fhxz31K2Fz59DQp: to=\<jeremy(a)domain.corp\>, relay=none, delay=0.02,  
> > > delays=0.01/0/0.01/0, dsn=5.4.6, status=bounced (mail for domain.corp  
> > > loops back to myself)  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/cleanup[39461]:  
> > > 4Fhxz31TYhz59DR5: message-id=\<  
> > > 4Fhxz31TYhz59DR5(a)testmail.mx.domain.corp\>  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > > 4Fhxz31TYhz59DR5: from=\<\>, size=2701, nrcpt=1 (queue active)  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/bounce[39465]:  
> > > 4Fhxz31K2Fz59DQp: sender non-delivery notification: 4Fhxz31TYhz59DR5  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/qmgr[39375]:  
> > > 4Fhxz31K2Fz59DQp: removed  
> > > May 15 00:36:15 testmail.mx.domain.corp postfix/error[39466]:  
> > > 4Fhxz31TYhz59DR5: to=\<jeremy(a)macbook-pro.adifferentdomain.intra\>,  
> > > relay=none, delay=0.01, delays=0/0/0/0, dsn=4.4.1, status=deferred  
> > > (delivery temporarily suspended: connect to macbook-  
> > > pro.adifferentdomain.intra[192.168.10.95]:25: Connection refused)
> > > 
> > > I’m not sure what I’m doing wrong. I basically want mail to be  
> > > delivered to the Ciphermail host for user jeremy.
> > > 
> > > Thanks  
> > > -jeremy
