summaryrefslogtreecommitdiff
path: root/external/plyer/platforms/macosx/email.py
diff options
context:
space:
mode:
authorLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
committerLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
commit9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch)
tree9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /external/plyer/platforms/macosx/email.py
parent11cc316b74d5f3f283413a33e7693b314741aa4a (diff)
downloadmanachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip
Initial commit
Diffstat (limited to 'external/plyer/platforms/macosx/email.py')
-rw-r--r--external/plyer/platforms/macosx/email.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/external/plyer/platforms/macosx/email.py b/external/plyer/platforms/macosx/email.py
new file mode 100644
index 0000000..8e29fa9
--- /dev/null
+++ b/external/plyer/platforms/macosx/email.py
@@ -0,0 +1,38 @@
+import subprocess
+
+try:
+ from urllib.parse import quote
+except ImportError:
+ from urllib import quote
+
+from plyer.facades import Email
+from plyer.utils import whereis_exe
+
+
+class MacOSXEmail(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))
+
+ subprocess.Popen(["open", uri])
+
+
+def instance():
+ import sys
+ if whereis_exe('open'):
+ return MacOSXEmail()
+ sys.stderr.write("open not found.")
+ return Email()