From 2896052fb60f10b16ca7003900563d0c0866890d Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Tue, 1 Apr 2014 21:43:26 -0400 Subject: [PATCH] add Windows email support --- plyer/platforms/win/email.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plyer/platforms/win/email.py diff --git a/plyer/platforms/win/email.py b/plyer/platforms/win/email.py new file mode 100644 index 000000000..9de5a221c --- /dev/null +++ b/plyer/platforms/win/email.py @@ -0,0 +1,28 @@ +import os +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') + create_chooser = kwargs.get('create_chooser') + + 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)) + + os.startfile(uri) + + +def instance(): + return WindowsEmail()