File: email.py

package info (click to toggle)
python-plyer 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,808 kB
  • sloc: python: 13,395; sh: 217; makefile: 177
file content (58 lines) | stat: -rw-r--r-- 1,460 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'''
Email
=====

The :class:`Email` provides access to public methods to use email of your
device.

.. note::
    On Android `INTERNET` permission is needed.

Simple Examples
---------------

To send an e-mail::

    >>> from plyer import email
    >>> recipient = 'abc@gmail.com'
    >>> subject = 'Hi'
    >>> text = 'This is an example.'
    >>> create_chooser = False
    >>> email.send(recipient=recipient, subject=subject, text=text,
                   create_chooser=create_chooser)

    >>> # opens email interface where user can change the content.

Supported Platforms
-------------------
Android, iOS, Windows, OS X, Linux

'''


class Email:
    '''
    Email facade.
    '''

    def send(self, recipient=None, subject=None, text=None,
             create_chooser=None):
        '''
        Open an email client message send window, prepopulated with the
        given arguments.

        :param recipient: Recipient of the message (str)
        :param subject: Subject of the message (str)
        :param text: Main body of the message (str)
        :param create_chooser: Whether to display a program chooser to
                               handle the message (bool)

        .. note:: create_chooser is only supported on Android
        '''
        self._send(recipient=recipient, subject=subject, text=text,
                   create_chooser=create_chooser)

    # private

    def _send(self, **kwargs):
        raise NotImplementedError()