[GH-ISSUE #1580] Catch all mail #1240

Closed
opened 2026-02-27 11:16:03 +03:00 by kerem · 11 comments
Owner

Originally created by @RT4U on GitHub (Oct 6, 2018).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1580

Impacted versions

  • Modoboa: X.X.x
  • installer used: Yes/No ?
  • Webserver: Nginx/Apache

Steps to reproduce

Current behavior

Expected behavior

Video/Screenshot link (optional)

Hi, how to create a catch all mail like, I wanted to send a mail with from address bounces(some random chars)@domain.com from the account admin@domain.com.

How to make one? Or is it even possible?

Originally created by @RT4U on GitHub (Oct 6, 2018). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1580 # Impacted versions * Modoboa: X.X.x * installer used: Yes/No ? * Webserver: Nginx/Apache # Steps to reproduce # Current behavior # Expected behavior # Video/Screenshot link (optional) Hi, how to create a catch all mail like, I wanted to send a mail with from address bounces(some random chars)@domain.com from the account admin@domain.com. How to make one? Or is it even possible?
kerem closed this issue 2026-02-27 11:16:04 +03:00
Author
Owner

@JOduMonT commented on GitHub (Oct 13, 2018):

Hi @RT4U
related to different issues (466, 298) your not the first at looking for a catchall.

So this is the way I did it
hopefully; a contributor will tell us if mess with this config or everything is fine.
my answer is inspired from this post

1. create /etc/postfix/virtual and add these lines

catchall@domain1.tld catchall@domain1.tld
@domain1.tld catchall@domain1.tld
@domain2.tld catchall@domain1.tld
@domain3.tld catchall@domain1.tld

NOTE: the 1st line, where you redirect catchall on catchall is apparently very important
where domain1.tld is your main domain

2. reference /etc/postfix/virtual in /etc/postfix/main.cf

around the line 75

...
## Virtual transport settings
#
virtual_transport = lmtp:unix:private/dovecot-lmtp

virtual_mailbox_domains = proxy:pgsql:/etc/postfix/sql-domains.cf
virtual_alias_domains = proxy:pgsql:/etc/postfix/sql-domain-aliases.cf
virtual_alias_maps =
        proxy:pgsql:/etc/postfix/sql-aliases.cf
        hash:/etc/postfix/virtual
...

NOTE: I gave you a context but I really just add the last line : hash:/etc/postfix/virtual

3. create the database

postmap /etc/postfix/virtual
this command will generate the /etc/postfix/virtual.db

4. restart or reload postfix

systemctl restart postfix
service postfix reload

5. attribute catchall to a user

untitled

<!-- gh-comment-id:429546913 --> @JOduMonT commented on GitHub (Oct 13, 2018): Hi @RT4U related to different issues ([466](https://github.com/modoboa/modoboa/issues/466), [298](https://github.com/modoboa/modoboa/issues/298)) your not the first at looking for a catchall. So this is the way I did it hopefully; a contributor will tell us if mess with this config or everything is fine. my answer is inspired from this [post](https://serverfault.com/questions/560906/postfix-virtual-aliases-and-catchall-for-undefined-addresses) ### 1. create `/etc/postfix/virtual` and add these lines ``` catchall@domain1.tld catchall@domain1.tld @domain1.tld catchall@domain1.tld @domain2.tld catchall@domain1.tld @domain3.tld catchall@domain1.tld ``` NOTE: the 1st line, _where you redirect catchall on catchall_ is apparently very important where domain1.tld is your main domain ### 2. reference /etc/postfix/virtual in /etc/postfix/main.cf around the line 75 ``` ... ## Virtual transport settings # virtual_transport = lmtp:unix:private/dovecot-lmtp virtual_mailbox_domains = proxy:pgsql:/etc/postfix/sql-domains.cf virtual_alias_domains = proxy:pgsql:/etc/postfix/sql-domain-aliases.cf virtual_alias_maps = proxy:pgsql:/etc/postfix/sql-aliases.cf hash:/etc/postfix/virtual ... ``` NOTE: _I gave you a context but I really just add the last line : `hash:/etc/postfix/virtual`_ ### 3. create the database `postmap /etc/postfix/virtual` this command will generate the /etc/postfix/virtual.db ### 4. restart or reload postfix `systemctl restart postfix` `service postfix reload` ### 5. attribute catchall to a user ![untitled](https://user-images.githubusercontent.com/5204724/46906483-8a2fb000-cf04-11e8-803f-b309037a9521.jpg)
Author
Owner

@RT4U commented on GitHub (Oct 14, 2018):

Hi @jodumont

Does this work for sending address?

Like I need to send with sender address as bounces-@domain.tld from admin@domain.tld.

<!-- gh-comment-id:429600362 --> @RT4U commented on GitHub (Oct 14, 2018): Hi @jodumont Does this work for sending address? Like I need to send with sender address as bounces-<randomcharacters>@domain.tld from admin@domain.tld.
Author
Owner

@JOduMonT commented on GitHub (Oct 14, 2018):

If I understand right your question and the project
I believe the account you create is for authentication
than the alias is for receiving email
and finally, sender addresses is where you add email you would like to use to send email but they are not an account and/or an alias
untitled

such as
you could have an account : compta@domain.tld
and as an alias the jean.bond@domain.tld because (Jean is your actual accountant)
and as sender addresses you will add bill@domain.tld
to let's Jean sender bill through this address.

<!-- gh-comment-id:429612401 --> @JOduMonT commented on GitHub (Oct 14, 2018): If I understand right your question and the project I believe the account you create is for authentication than the alias is for receiving email and finally, **sender addresses** is where you add email you would like to use to send email but they are not an account and/or an alias ![untitled](https://user-images.githubusercontent.com/5204724/46915291-b3564c00-cfa9-11e8-93e8-f47fb48c389c.jpg) such as you could have an _account_ : compta@domain.tld and as an _alias_ the jean.bond@domain.tld because (Jean is your actual accountant) and as _sender addresses_ you will add bill@domain.tld to let's Jean sender bill through this address.
Author
Owner

@RT4U commented on GitHub (Oct 14, 2018):

I get it @jodumont

But that's not what I wanted. I need to the sender address to be a catch all address. Like jean@domain.tld could be able to send from bill@domain.tld instead of just bill@domain.tld

I've used it by editing postfix in the past, when I am setting up my own custom mail server, but I couldn't remember that. Is it possible to do it here?

<!-- gh-comment-id:429612639 --> @RT4U commented on GitHub (Oct 14, 2018): I get it @jodumont But that's not what I wanted. I need to the sender address to be a catch all address. Like jean@domain.tld could be able to send from bill<somerandomchars>@domain.tld instead of just bill@domain.tld I've used it by editing postfix in the past, when I am setting up my own custom mail server, but I couldn't remember that. Is it possible to do it here?
Author
Owner

@RT4U commented on GitHub (Oct 14, 2018):

Oh lol, github removes the angle brackets, I just noticed it. I should be able to send with bill(some random chars)@domain.tld from jean@domain.tld. A catch all sender address.

@jodumont

<!-- gh-comment-id:429617634 --> @RT4U commented on GitHub (Oct 14, 2018): Oh lol, github removes the angle brackets, I just noticed it. I should be able to send with bill(some random chars)@domain.tld from jean@domain.tld. A catch all sender address. @jodumont
Author
Owner

@JOduMonT commented on GitHub (Oct 14, 2018):

hum; I never ear about this
a quick look (because I'm curious :) let's me found this

but you should definitely change the name of your issue for something like :
how to setup a catch all sender address or how to setup a dynamic sender address

<!-- gh-comment-id:429622888 --> @JOduMonT commented on GitHub (Oct 14, 2018): hum; I never ear about this a quick look (because I'm curious :) let's me [found this](https://superuser.com/questions/1199492/how-to-setup-a-dynamic-sender-address-for-a-catchall-mail-address-with-dovecot-a) but you should definitely change the name of your issue for something like : `how to setup a catch all sender address` or `how to setup a dynamic sender address`
Author
Owner

@RT4U commented on GitHub (Oct 14, 2018):

I don't know how to edit the title, but I've changed the description. Never thought GitHub would just cut whatever inside the angle brackets instead of normalising

<!-- gh-comment-id:429623128 --> @RT4U commented on GitHub (Oct 14, 2018): I don't know how to edit the title, but I've changed the description. Never thought GitHub would just cut whatever inside the angle brackets instead of normalising
Author
Owner

@JOduMonT commented on GitHub (Oct 14, 2018):

on stack overflow family site it's also hard to edit properly
that's why I love screenshot :P

to edit your title you should have an edit button
untitled

<!-- gh-comment-id:429624912 --> @JOduMonT commented on GitHub (Oct 14, 2018): on stack overflow family site it's also hard to edit properly that's why I love screenshot :P to edit your title you should have an **edit button** ![untitled](https://user-images.githubusercontent.com/5204724/46917004-75195680-cfc2-11e8-8ba0-e80912e8aef9.jpg)
Author
Owner

@tonioo commented on GitHub (Oct 15, 2018):

@RT4U Have you tried to add a sender address of the form @domain.tld to your account?

<!-- gh-comment-id:429900816 --> @tonioo commented on GitHub (Oct 15, 2018): @RT4U Have you tried to add a sender address of the form @domain.tld to your account?
Author
Owner

@RT4U commented on GitHub (Oct 16, 2018):

I tried adding it. But didn't work. It stays that sender is not owned by admin@domain.tld

<!-- gh-comment-id:430232017 --> @RT4U commented on GitHub (Oct 16, 2018): I tried adding it. But didn't work. It stays that sender is not owned by admin@domain.tld
Author
Owner

@tonioo commented on GitHub (Oct 17, 2018):

@RT4U Can you provided a screenshot?

<!-- gh-comment-id:430610632 --> @tonioo commented on GitHub (Oct 17, 2018): @RT4U Can you provided a screenshot?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1240
No description provided.