doc/source/vmm_emailaddress.rst
author martin f. krafft <madduck@madduck.net>
Sun, 15 Apr 2012 17:51:00 +0200
branchv0.6.x
changeset 550 867d950ce7b7
parent 216 0c8c053b451c
permissions -rw-r--r--
Fix transport_maps function for non-existent domains The postfix_transport_maps function had a bug causing 2012-04-15 17:40:22 CEST LOG: statement: SELECT transport FROM postfix_transport_map('logcheck', 'domine.madduck.net'); 2012-04-15 17:40:22 CEST ERROR: query returned no rows when the domain was not in the database. This would make did be NULL and make the query fail. This patch moves the tid query until after a check for did. If the latter is NULL, the function RETURNs (rather than fails).

:mod:`VirtualMailManager.EmailAddress` --- Handling of e-mail addresses
=======================================================================

.. module:: VirtualMailManager.EmailAddress
  :synopsis: Handling of e-mail addresses

.. moduleauthor:: Pascal Volk <neverseen@users.sourceforge.net>

.. toctree::
   :maxdepth: 2


This module provides the :class:`EmailAddress` class to handle validated e-mail
addresses.


EmailAddress
------------

.. class:: EmailAddress(address)

  Creates a new EmailAddress instance.

  :param address: string representation of an e-mail addresses
  :type address: :obj:`basestring`
  :raise VirtualMailManager.errors.EmailAddressError: if the
    *address* is syntactically wrong.
  :raise VirtualMailManager.errors.VMMError: if the validation of the
    local-part or domain name fails.

  An EmailAddress instance has the both read-only attributes:

  .. attribute:: localpart

    The local-part of the address *local-part@domain*


  .. attribute:: domainname

    The domain part of the address *local-part@domain*


Examples
--------

  >>> from VirtualMailManager.EmailAddress import EmailAddress
  >>> john = EmailAddress('john.doe@example.com')
  >>> john.localpart
  'john.doe'
  >>> john.domainname
  'example.com'
  >>> jane = EmailAddress('jane.doe@example.com')
  >>> jane != john
  True
  >>> EmailAddress('info@xn--pypal-4ve.tld') == EmailAddress(u'info@pŠ°ypal.tld')
  True
  >>> jane
  EmailAddress('jane.doe@example.com')
  >>> print john
  john.doe@example.com
  >>>