| 1 |
''' |
| 2 |
Email |
| 3 |
===== |
| 4 |
|
| 5 |
The :class:`Email` provides access to public methods to use email of your |
| 6 |
device. |
| 7 |
|
| 8 |
.. note:: |
| 9 |
On Android `INTERNET` permission is needed. |
| 10 |
|
| 11 |
Simple Examples |
| 12 |
--------------- |
| 13 |
|
| 14 |
To send an e-mail:: |
| 15 |
|
| 16 |
>>> from plyer import email |
| 17 |
>>> recipient = '[email protected]' |
| 18 |
>>> subject = 'Hi' |
| 19 |
>>> text = 'This is an example.' |
| 20 |
>>> create_chooser = False |
| 21 |
>>> email.send(recipient=recipient, subject=subject, text=text, |
| 22 |
create_chooser=create_chooser) |
| 23 |
|
| 24 |
>>> # opens email interface where user can change the content. |
| 25 |
|
| 26 |
Supported Platforms |
| 27 |
------------------- |
| 28 |
Android, iOS, Windows, OS X, Linux |
| 29 |
|
| 30 |
''' |
| 31 |
|
| 32 |
|
| 33 |
class Email: |
| 34 |
''' |
| 35 |
Email facade. |
| 36 |
''' |
| 37 |
|
| 38 |
def send(self, recipient=None, subject=None, text=None, |
| 39 |
create_chooser=None): |
| 40 |
''' |
| 41 |
Open an email client message send window, prepopulated with the |
| 42 |
given arguments. |
| 43 |
|
| 44 |
:param recipient: Recipient of the message (str) |
| 45 |
:param subject: Subject of the message (str) |
| 46 |
:param text: Main body of the message (str) |
| 47 |
:param create_chooser: Whether to display a program chooser to |
| 48 |
handle the message (bool) |
| 49 |
|
| 50 |
.. note:: create_chooser is only supported on Android |
| 51 |
''' |
| 52 |
self._send(recipient=recipient, subject=subject, text=text, |
| 53 |
create_chooser=create_chooser) |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
def _send(self, **kwargs): |
| 58 |
raise NotImplementedError() |