doc/source/vmm_emailaddress.rst
author martin f. krafft <madduck@madduck.net>
Tue, 10 Apr 2012 22:56:30 +0200
branchv0.6.x
changeset 514 d863a44a6353
parent 216 0c8c053b451c
permissions -rw-r--r--
Make PL/pgSQL function feed back identity for mailboxes/relocated when there are catchall destinations. Without catchall aliases, if no virtual_alias matches, the query can just return NULL and Postfix will later check mailboxes/relocated for the address to rewrite. However, since virtual aliases are handled long before mailboxes/relocated, a catchall alias would also catch mail to mailboxes and relocated addresses, which we do not want. The way to tell postfix to keep delivering is for the virtual alias map to return the search key itself (identity function). This patch changes the postfix_virtual_alias_maps Pl/pgSQL function to do exactly that, but only if there are catchall destinations defined for the domain in question — otherwise it returns NULL when no match is found.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
212
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
:mod:`VirtualMailManager.EmailAddress` --- Handling of e-mail addresses
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
=======================================================================
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
.. module:: VirtualMailManager.EmailAddress
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
  :synopsis: Handling of e-mail addresses
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
.. moduleauthor:: Pascal Volk <neverseen@users.sourceforge.net>
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     9
.. toctree::
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    10
   :maxdepth: 2
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    13
This module provides the :class:`EmailAddress` class to handle validated e-mail
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    14
addresses.
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    15
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    17
EmailAddress
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    18
------------
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    20
.. class:: EmailAddress(address)
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
  Creates a new EmailAddress instance.
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    23
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    24
  :param address: string representation of an e-mail addresses
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
  :type address: :obj:`basestring`
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 212
diff changeset
    26
  :raise VirtualMailManager.errors.EmailAddressError: if the
212
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
    *address* is syntactically wrong.
216
0c8c053b451c Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 212
diff changeset
    28
  :raise VirtualMailManager.errors.VMMError: if the validation of the
212
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    29
    local-part or domain name fails.
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    31
  An EmailAddress instance has the both read-only attributes:
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    33
  .. attribute:: localpart
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    34
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    35
    The local-part of the address *local-part@domain*
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    36
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    37
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    38
  .. attribute:: domainname
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    39
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    40
    The domain part of the address *local-part@domain*
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    41
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    42
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    43
Examples
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    44
--------
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    46
  >>> from VirtualMailManager.EmailAddress import EmailAddress
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    47
  >>> john = EmailAddress('john.doe@example.com')
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    48
  >>> john.localpart
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    49
  'john.doe'
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    50
  >>> john.domainname
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    51
  'example.com'
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    52
  >>> jane = EmailAddress('jane.doe@example.com')
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    53
  >>> jane != john
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    54
  True
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    55
  >>> EmailAddress('info@xn--pypal-4ve.tld') == EmailAddress(u'info@pаypal.tld')
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    56
  True
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    57
  >>> jane
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    58
  EmailAddress('jane.doe@example.com')
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    59
  >>> print john
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    60
  john.doe@example.com
77ac6f572855 doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    61
  >>>