-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgmail-mailto
executable file
·22 lines (15 loc) · 1.07 KB
/
gmail-mailto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
BROWSER="firefox-bin"
#when we are passed an email address like this:
#mailto:[email protected]?subject=hi%20vernon&body=please%20unsubscribe%20me%20from%20this%20mad%20list&[email protected]&[email protected]
#we want to generate a uri like this:
#http://mail.google.com/mail/?view=cm&tf=0&[email protected]&[email protected]&[email protected]&su=hi%20vernon&body=please%20unsubscribe%20me%20from%20this%20mad%20list&zx=9i09cu-h33iui
#Unless you are using gmail for a hosted domain, then you want to use this:
#http://mail.google.com/a/domain.tld/?view=cm&tf=0&[email protected]&[email protected]&[email protected]&su=hi%20vernon&body=please%20unsubscribe%20me%20from%20this%20mad%20list&zx=9i09cu-h33iui
#NOTE from and the editor of the above line: the /a/ may differ from domain to domain, I'm not sure I only have one hosted domain.
# remove the ? from the uri
uri=`echo "$1" | sed -e 's/subject=/su=/' -e 's/^mailto:\([^&?]\+\)[?&]\?\(.*\)$/\1\&\2/'`
if [ "$uri" ];
then exec $BROWSER "https://mail.google.com/mail?view=cm&tf=0&ui=1&to=$uri"
fi
exec $BROWSER "https://mail.google.com/"