1

Topic: can't send to localhost - probable mydestination issue

==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version: 0.8.3
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version:  FreeBSD 9.1
- Related log if you're reporting an issue:
====

Hi.

Mail flow is okay, the only problem is bouncing emails (see logs below). Though mailing to fetchmail@localhost.localdomain works fine (at least it accepts the address). I suppose there are something in either my hosts file or mydestination parameter.

> telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to data2.mydomain.com.
Escape character is '^]'.
220 data2.mydomain.com ESMTP Postfix
helo data.mydomain.com
250 data2.mydomain.com
mail from:<>
250 2.1.0 Ok
rcpt to:<fetchmail@localhost.localdomain>
250 2.1.5 Ok
rcpt to:<fetchmail@localhost>
450 4.1.2 <fetchmail@localhost>: Recipient address rejected: Domain not found


Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> RCPT TO:<nonexistent_user@data.mydomain.com>
Nov 12 14:27:03 data2 postfix/smtpd[1455]: NOQUEUE: reject: RCPT from data2.mydomain.com[127.0.0.1]: 550 5.1.1 <nonexistent_user@data.mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<some_other_user@other.domain> to=<nonexistent_user@data.mydomain.com> proto=ESMTP helo=<data2.mydomain.com>
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 550 5.1.1 <nonexistent_user@data.mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP error: 550 5.1.1 <nonexistent_user@data.mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP listener doesn't like recipient address `nonexistent_user@data.mydomain.com'
Nov 12 14:27:03 data2 postfix/smtpd[1458]: connect from data2.mydomain.com[127.0.0.1]
Nov 12 14:27:03 data2 fetchmail[1453]: Trying to connect to 127.0.0.1/25...connected.
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 220 data2.mydomain.com ESMTP Postfix
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> HELO data2.mydomain.com
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 250 data2.mydomain.com
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> MAIL FROM:<>
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 250 2.1.0 Ok
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> RCPT TO:<some_other_user@other.domain>
Nov 12 14:27:03 data2 postfix/smtpd[1458]: 3B6091D6BC6: client=data2.mydomain.com[127.0.0.1]
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 250 2.1.5 Ok
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> DATA
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 354 End data with <CR><LF>.<CR><LF>
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP: (bounce-message body)
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP>. (EOM)
Nov 12 14:27:03 data2 postfix/cleanup[1459]: 3B6091D6BC6: message-id=<20131112102703.3B6091D6BC6@data2.mydomain.com>
Nov 12 14:27:03 data2 postfix/qmgr[1424]: 3B6091D6BC6: from=<>, size=3959, nrcpt=1 (queue active)
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 250 2.0.0 Ok: queued as 3B6091D6BC6
Nov 12 14:27:03 data2 postfix/smtpd[1458]: disconnect from data2.mydomain.com[127.0.0.1]
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> QUIT
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 221 2.0.0 Bye
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP> RCPT TO:<fetchmail@localhost>
Nov 12 14:27:03 data2 postfix/smtpd[1455]: NOQUEUE: reject: RCPT from data2.mydomain.com[127.0.0.1]: 450 4.1.2 <fetchmail@localhost>: Recipient address rejected: Domain not found; from=<some_other_user@other.domain> to=<fetchmail@localhost> proto=ESMTP helo=<data2.mydomain.com>
Nov 12 14:27:03 data2 fetchmail[1453]: SMTP< 450 4.1.2 <fetchmail@localhost>: Recipient address rejected: Domain not found
Nov 12 14:27:03 data2 fetchmail[1453]: can't even send to fetchmail!


>cat /etc/hosts

::1             ipv6-localhost
127.0.0.1       data2.mydomain.com data2 localhost localhost.localdomain

>cat /var/spool/postfix/etc/hosts

::1             ipv6-localhost
127.0.0.1       data2.mydomain.com data2 localhost localhost.localdomain

>hostname -f

data2.mydomain.com

>cat main.cf

....

myhostname = data2.mydomain.com
smtp_host_lookup = dns, native
lmtp_host_lookup = dns, native
myorigin = data.mydomain.com
mydomain = mydomain.com
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
biff = no
inet_interfaces = all
mynetworks = 127.0.0.0/8 [::1]/128
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sender_restrictions = permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated

....

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: can't send to localhost - probable mydestination issue

Postfix will accept emails sent to below domains (and virtual_mailbox_domains):

mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname

So, it will be expanded to be:

mydestination = data2.mydomain.com, localhost, localhost.localdomain, localhost.data2.mydomain.com

Emails sent by your LOCAL users to 'xx@localhost' will be delivered locally (to system accounts).

I didn't see you have 'data.mydomain.com' as destination domain, so if you use 'xx@data.mydomain.com' as recipient, it will fail.

3

Re: can't send to localhost - probable mydestination issue

I have it in virtual_mailbox_domains

mysql> select domain from vmail.domain;
+-------------+
| domain      |
+-------------+
| data.mydomain.com |
+-------------+

and when I add it to mydestination it tells me that I shouldn't do that (warning: do not list domain data.mydomain.com in BOTH mydestination and virtual_mailbox_domains).
More than that, now after some modifications made to main.cf I receive message that mail for 127.0.0.1 loops back to myself sad

4

Re: can't send to localhost - probable mydestination issue

I think I must clarify the config.
I use my provider's mailserver as a relay and mail collector. Then I get it by fetchmail.

5

Re: can't send to localhost - probable mydestination issue

As far as I understand fetchmail gets mail from my provider, then it goes thru all the queue when on sertain step it decides that it loops sad

6

Re: can't send to localhost - probable mydestination issue

Now trying to send mail via telnet, without fetching it from ISP

here's my transport_map value btw (maybe it's important?)

transport_maps = hash:/usr/local/etc/postfix/transport, proxy:mysql:/usr/local/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/usr/local/etc/postfix/mysql/transport_maps_domain.cf

Here's my transport file (I need that users were able to send mail to a limited number of domains):

some_domain1.com   smtp:[relay]:25
some_domain2.com   smtp:[relay]:25
some_domain3.com   smtp:[relay]:25
data.mydomain.com     smtp:[127.0.0.1]:25
data2.mydomain.com    smtp:[127.0.0.1]:25
*               discard:


Nov 14 23:28:16 data2 postfix/master[5800]: daemon started -- version 2.7.12, configuration /usr/local/etc/postfix
Nov 14 23:28:25 data2 postfix/smtpd[5807]: connect from localhost[127.0.0.1]
Nov 14 23:28:47 data2 postfix/smtpd[5807]: DC6B51D6BE2: client=localhost[127.0.0.1]
Nov 14 23:28:52 data2 postfix/cleanup[5813]: DC6B51D6BE2: message-id=<20131114192847.DC6B51D6BE2@data2.mydomain.com>
Nov 14 23:28:52 data2 postfix/qmgr[5802]: DC6B51D6BE2: from=<>, size=327, nrcpt=1 (queue active)
Nov 14 23:28:54 data2 postfix/smtpd[5807]: disconnect from localhost[127.0.0.1]
Nov 14 23:28:55 data2 postfix/smtpd[5815]: connect from localhost[127.0.0.1]
Nov 14 23:28:55 data2 postfix/smtpd[5815]: 447661D6BE3: client=localhost[127.0.0.1]
Nov 14 23:28:55 data2 postfix/cleanup[5813]: 447661D6BE3: message-id=<20131114192847.DC6B51D6BE2@data2.mydomain.com>
Nov 14 23:28:55 data2 postfix/smtpd[5815]: disconnect from localhost[127.0.0.1]
Nov 14 23:28:55 data2 amavis[931]: (00931-13) Passed BAD-HEADER-1 {RelayedInternal}, MYNETS LOCAL [127.0.0.1]:12044 [127.0.0.1] <> -> <some_user@data.mydomain.com>, Message-ID: <20131114192847.DC6B51D6BE2@data2.mydomain.com>, mail_id: vOvH672Gorb9, Hits: -5.709, size: 329, queued_as: 447661D6BE3, 2470 ms
Nov 14 23:28:55 data2 postfix/qmgr[5802]: 447661D6BE3: from=<>, size=862, nrcpt=1 (queue active)
Nov 14 23:28:55 data2 postfix/smtp[5814]: DC6B51D6BE2: to=<some_user@data.mydomain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=12, delays=9.6/0.01/0/2.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 447661D6BE3)
Nov 14 23:28:55 data2 postfix/qmgr[5802]: DC6B51D6BE2: removed
Nov 14 23:28:55 data2 postfix/smtp[5816]: 447661D6BE3: to=<some_user@data.mydomain.com>, relay=none, delay=0.03, delays=0.01/0.02/0/0, dsn=5.4.6, status=bounced (mail for 127.0.0.1 loops back to myself)
Nov 14 23:28:55 data2 postfix/qmgr[5802]: 447661D6BE3: removed

7

Re: can't send to localhost - probable mydestination issue

sturi wrote:

Nov 14 23:28:55 data2 postfix/smtp[5816]: 447661D6BE3: to=<some_user@data.mydomain.com>, relay=none, delay=0.03, delays=0.01/0.02/0/0, dsn=5.4.6, status=bounced (mail for 127.0.0.1 loops back to myself)

if you have to send email via ISP's mail server, configure Postfix parameter "relayhost=" to do this.
Reference: http://www.postfix.org/postconf.5.html#relayhost

8

Re: can't send to localhost - probable mydestination issue

the thing is that I'm sending it locally, this server should accept mails for data.mydomain.com

9

Re: can't send to localhost - probable mydestination issue

What is more, outgoing mail flow works fine, I just can't send mail for any user @data.mydomain.com either from inside or outside, constantly getting loop back error

10

Re: can't send to localhost - probable mydestination issue

sturi wrote:

data.mydomain.com     smtp:[127.0.0.1]:25

You should set a LDA instead of a smtp transport. For example:

data.mydomain.com     dovecot

11

Re: can't send to localhost - probable mydestination issue

Thanks! Will try that shortly!

12 (edited by sturi 2013-11-16 03:24:44)

Re: can't send to localhost - probable mydestination issue

It actually worked, thank you!