diff options
Diffstat (limited to 'external/plyer/platforms/win/email.py')
-rw-r--r-- | external/plyer/platforms/win/email.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/external/plyer/platforms/win/email.py b/external/plyer/platforms/win/email.py new file mode 100644 index 0000000..e33f5cf --- /dev/null +++ b/external/plyer/platforms/win/email.py @@ -0,0 +1,34 @@ +import os +try: + from urllib.parse import quote +except ImportError: + from urllib import quote +from plyer.facades import Email + + +class WindowsEmail(Email): + def _send(self, **kwargs): + recipient = kwargs.get('recipient') + subject = kwargs.get('subject') + text = kwargs.get('text') + + uri = "mailto:" + if recipient: + uri += str(recipient) + if subject: + uri += "?" if not "?" in uri else "&" + uri += "subject=" + uri += quote(str(subject)) + if text: + uri += "?" if not "?" in uri else "&" + uri += "body=" + uri += quote(str(text)) + + try: + os.startfile(uri) + except WindowsError: + print("Warning: unable to find a program able to send emails.") + + +def instance(): + return WindowsEmail() |