Configure Mail Server to receive mail from any domain [closed]
Asked Answered
Z

2

7

I have a postfix mail server on ubuntu on my virtualbox,now the domain of the mail server is abc.com...hence it receives mail from any "from address" but the "to address" needs to be proper i.e a valid user in the mailserver.

Now,in my project i am sending fake mails to user whose mail id consists of other domains too...like cde.com

My final objective is to show the mails in the mail server.

When i tried that ,it goes directly in to the mailserveer logs i.e /var/log/mail.log i.e as an error

is there any way i can store these mails in the mailserver??

Zaccaria answered 23/1, 2011 at 4:0 Comment(1)
This is offtopic: move to serverfault.Jugular
B
5

You want not only a Catch-All configuration like accepting any mail to *@abc.com but also to have a Catch-Anything configuration to accept any mail to *@* ?

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

Make sure that your Postfix is already configured to accept mail for at least one user and one domain. And that this is tested.

  1. In main.conf set

    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
    

The hash: parts are the known from the docs. And the pcre: parts are new. The hash: parts can also be omitted.

  1. Create the file virtual_domains.pcre with the following content:

    /^.*/       OK
    

This accepts any domain as valid recipient domain.

  1. Create the file virtual_forwardings.pcre with the following content:

    /@.*/     [email protected]
    

This forwards any local part of any domain to the Postfix user [email protected]. Make sure that this is a valid virtual or local user.

In this configuration it seems that Postfix is an Open Relay, but it does not relay for other domains. It accepts mails for any domain and locally delivers the mail to one mailbox.

Sometimes you will then notice a log entry telling you something like "don't list abc.com in mydestination and virtual config". This warning can be ignored as this "strange" setup is not usual.

Bondholder answered 17/3, 2011 at 12:40 Comment(1)
looks like virtual_mailbox_base also must been setInscribe
M
2

FTR:

An alternative way to do it by sending any mail to "some.local.user" (a 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 (catchall mapped to "some.local.user")

/\/@/            some.local.user

__

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

/.*/    OK
Mealtime answered 22/4, 2011 at 21:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.