doc/source/vmm_emailaddress.rst
changeset 571 a4aead244f75
parent 216 0c8c053b451c
equal deleted inserted replaced
465:c0e1fb1b0145 571:a4aead244f75
       
     1 :mod:`VirtualMailManager.EmailAddress` --- Handling of e-mail addresses
       
     2 =======================================================================
       
     3 
       
     4 .. module:: VirtualMailManager.EmailAddress
       
     5   :synopsis: Handling of e-mail addresses
       
     6 
       
     7 .. moduleauthor:: Pascal Volk <neverseen@users.sourceforge.net>
       
     8 
       
     9 .. toctree::
       
    10    :maxdepth: 2
       
    11 
       
    12 
       
    13 This module provides the :class:`EmailAddress` class to handle validated e-mail
       
    14 addresses.
       
    15 
       
    16 
       
    17 EmailAddress
       
    18 ------------
       
    19 
       
    20 .. class:: EmailAddress(address)
       
    21 
       
    22   Creates a new EmailAddress instance.
       
    23 
       
    24   :param address: string representation of an e-mail addresses
       
    25   :type address: :obj:`basestring`
       
    26   :raise VirtualMailManager.errors.EmailAddressError: if the
       
    27     *address* is syntactically wrong.
       
    28   :raise VirtualMailManager.errors.VMMError: if the validation of the
       
    29     local-part or domain name fails.
       
    30 
       
    31   An EmailAddress instance has the both read-only attributes:
       
    32 
       
    33   .. attribute:: localpart
       
    34 
       
    35     The local-part of the address *local-part@domain*
       
    36 
       
    37 
       
    38   .. attribute:: domainname
       
    39 
       
    40     The domain part of the address *local-part@domain*
       
    41 
       
    42 
       
    43 Examples
       
    44 --------
       
    45 
       
    46   >>> from VirtualMailManager.EmailAddress import EmailAddress
       
    47   >>> john = EmailAddress('john.doe@example.com')
       
    48   >>> john.localpart
       
    49   'john.doe'
       
    50   >>> john.domainname
       
    51   'example.com'
       
    52   >>> jane = EmailAddress('jane.doe@example.com')
       
    53   >>> jane != john
       
    54   True
       
    55   >>> EmailAddress('info@xn--pypal-4ve.tld') == EmailAddress(u'info@pŠ°ypal.tld')
       
    56   True
       
    57   >>> jane
       
    58   EmailAddress('jane.doe@example.com')
       
    59   >>> print john
       
    60   john.doe@example.com
       
    61   >>>