public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
Improve send-as behaviour
Receiving mails for wildcard alias addresses is really easy – but sending mails from those any-aliases was not possible at all unless every sender address was added as an explicit alias to the database. By this change in the database query for allowed sender addresses, the first finding `not NULL` (see [`SELECT COALESCE`](https://www.w3schools.com/sql/func_sqlserver_coalesce.asp) for how it works) – either an exact alias `[email protected]` or the wildcard alias `@domain.tld` will be allowed to send mails as the given address ... without the need of explicit definition within the database.
b985ba4f
data/Dockerfiles/postfix/postfix.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
Diff
diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh
index e734a9ab..78b070e0 100755
--- a/data/Dockerfiles/postfix/postfix.sh
+++ b/data/Dockerfiles/postfix/postfix.sh
@@ -323,7 +323,19 @@ hosts = unix:/var/run/mysqld/mysqld.sock
dbname = ${DBNAME}
# First select queries domain and alias_domain to determine if domains are active.
query = SELECT goto FROM alias
- WHERE address='%s'
+ WHERE id IN (
+ SELECT COALESCE (
+ (
+ SELECT id FROM alias
+ WHERE address='%s'
+ AND (active='1' OR active='2')
+ ), (
+ SELECT id FROM alias
+ WHERE address='@%d'
+ AND (active='1' OR active='2')
+ )
+ )
+ )
AND active='1'
AND (domain IN
(SELECT domain FROM domain
@@ -354,7 +366,7 @@ query = SELECT goto FROM alias
WHERE alias_domain.alias_domain = '%d'
AND mailbox.username = CONCAT('%u','@',alias_domain.target_domain)
AND (mailbox.active = '1' OR mailbox.active ='2')
- AND alias_domain.active='1'
+ AND alias_domain.active='1';
EOF
# MX based routing