Browse Source

Merge pull request #90 from andryyy/master

Merge
André Peters 8 years ago
parent
commit
dff2a726f9
2 changed files with 48 additions and 2 deletions
  1. 13 2
      data/web/inc/functions.inc.php
  2. 35 0
      docs/first_steps.md

+ 13 - 2
data/web/inc/functions.inc.php

@@ -4877,12 +4877,23 @@ function mailbox_get_sender_acl_handles($mailbox) {
   $data['fixed_sender_aliases']                   = array();
   
   try {
-    $stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` = :goto AND `address` NOT LIKE '@%'");
-    $stmt->execute(array(':goto' => $mailbox));
+    // Fixed addresses
+    $stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` LIKE :goto AND `address` NOT LIKE '@%'");
+    $stmt->execute(array(':goto' => '%' . $mailbox . '%'));
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     while ($row = array_shift($rows)) {
       $data['fixed_sender_aliases'][] = $row['address'];
     }
+    $stmt = $pdo->prepare("SELECT CONCAT(`local_part`, '@', `alias_domain`.`alias_domain`) AS `alias_domain_alias` FROM `mailbox`, `alias_domain`
+      WHERE `alias_domain`.`target_domain` = `mailbox`.`domain`
+      AND `mailbox`.`username` = :username");
+    $stmt->execute(array(':username' => $mailbox));
+    $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+    while ($row = array_shift($rows)) {
+      if (!empty($row['alias_domain_alias'])) {
+        $data['fixed_sender_aliases'][] = $row['alias_domain_alias'];
+      }
+    }
 
     // Return array $data['sender_acl_domains/addresses']['ro'] with read-only objects
     // Return array $data['sender_acl_domains/addresses']['rw'] with read-write objects (can be deleted)

+ 35 - 0
docs/first_steps.md

@@ -133,3 +133,38 @@ server {
 }
 ```
 
+# Sender and receiver model
+
+When a mailbox is created, a user is allowed to send mail from and receive mail for his own mailbox address.
+
+    Mailbox me@example.org is created. example.org is a primary domain. 
+    Note: a mailbox cannot be created in an alias domain.
+
+    me@example.org is only known as me@example.org.
+    me@example.org is allowed to send as me@example.org.
+
+We can add an alias domain for example.org:
+
+    Alias domain alias.com is added and assigned to primary domain example.org.
+    me@example.org is now known as me@example.org and me@alias.com.
+    me@example.org is now allowed to send as me@example.org and me@alias.com.
+
+We can add aliases for a mailbox to receive mail for and to send from this new address.
+
+It is important to know, that you are not able to receive mail for `my-alias@my-alias-domain.tld`. You would need to create this particular alias.
+
+    me@example.org is assigned the alias alias@example.org
+    me@example.org is now known as alias@example.org, me@alias.com, alias@example.org
+
+    me@example.org is NOT known as alias@alias.com.
+
+Administrators and domain administrators can edit mailboxes to allow specific users to send as other mailbox users ("delegate" them).
+
+You can choose between mailbox users or completely disable the sender check for domains.
+
+**SOGo "mail from" addresses**
+
+Mailbox users can, obviously, select their own mailbox address, as well as all alias addresses and aliases that exist through alias domains.
+
+If you want to select another _existing_ mailbox user as your "mail from" address, this user has to delegate you access through SOGo (see SOGo documentation). Moreover a mailcow (domain) administrator
+needs to grant you access as described above.