Configure a mail server to receive mail from any domain

I have a postfix mail server on ubuntu on my virtual box, now the mail server domain is abc.com ... so it receives mail from any "from address", but the "address" must be correct, i.e. A valid user on the mail server.

Now, in my project, I send fake emails to a user whose mail id consists of other domains too ... for example cde.com

My ultimate goal is to show mail on the mail server.

When I tried this, it goes directly to the mailserveer logs ie / var / log / mail.log ie as an error

Is there any way to save these letters in the mail server?

+7
source share
2 answers

Do you want to have not only a Catch-All configuration, like receiving any mail to *@abc.com, but also a Catch-Anything configuration to receive any mail at * @ *?

This is possible if you have PCRE support compiled in Postfix. Then you will need virtual users in your configuration (see the Posfix documentation) and configure it as follows:

Make sure Postfix is ​​already configured to accept mail for at least one user and one domain. And it is checked.

1) In main.conf install

virtual_alias_domains =
virtual_alias_maps = hash: / etc / postfix / virtual_forwardings, pcre: /etc/postfix/virtual_forwardings.pcre virtual_mailbox_domains = hash: / etc / postfix / virtual_domains, pcre: /etc/postfix/virtual_domains.pcre

Parts of hash: are known from the docs. And pcre: parts pcre: are new. Parts of hash: may also be omitted.

2) Create a virtual_domains.pcre file with the following contents:

/^.*/OK

Accepts any domain as a valid recipient domain.

3) Create a virtual_forwardings.pcre file with the following contents:

/@.*/ someuser@example.com

This forwards any local part of any domain to a Postfix user someuser@example.com. Verify that this is a valid virtual or local user.

In this configuration, Postfix seems to be an open relay, but it is not relayed to other domains. It accepts mail for any domain and locally delivers mail to one mailbox.

Sometimes you may notice a log entry telling you something like "don't list abc.com in mydestination and virtual config". This warning can be ignored because this “weird” setting is not normal.

+5
source

FTR:

An alternative way to do this is by sending any mail to "some.local.user" (shell user)

Required: postfix-pcre package

in main.cf

 luser_relay = some.local.user local_recipient_maps = virtual_alias_maps = pcre:/etc/postfix/virtual_alias.pcre mydestination = $myhostname, pcre:/etc/postfix/mydestination.pcre 

File: /etc/postfix/virtual_alias.pcre (binding to "some.local.user")

 /\/@/ some.local.user __ 

File: /etc/postfix/mydestination.pcre (we accept everything that you throw at us)

 /.*/ OK 
+1
source

All Articles