Skip to content

Instantly share code, notes, and snippets.

Last active August 7, 2019 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheagcraig/16e9d6a01406de06c524 to your computer and use it in GitHub Desktop.
Save sheagcraig/16e9d6a01406de06c524 to your computer and use it in GitHub Desktop.
Set Microsoft Outlook as Default Handler for mailto, vcf, and ics
# Put in /usr/local/share/luggage/ to reap the rewards.
l_usr_local_outset: l_usr_local
@sudo mkdir -p ${WORK_D}/usr/local/outset/{firstboot-packages,firstboot-scripts,everyboot-scripts,login-every,login-once,on-demand}
@sudo chown -R root:wheel ${WORK_D}/usr/local/outset
@sudo chmod -R 755 ${WORK_D}/usr/local/outset
pack-outset-firstboot-packages-%: % l_usr_local_outset
@sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/outset/firstboot-packages
pack-outset-firstboot-scripts-%: % l_usr_local_outset
@sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/outset/firstboot-scripts
pack-outset-everyboot-scripts-%: % l_usr_local_outset
@sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/outset/everyboot-scripts
pack-outset-login-every-%: % l_usr_local_outset
@sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/outset/login-every
pack-outset-login-once-%: % l_usr_local_outset
@sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/outset/login-once
pack-outset-on-demand-%: % l_usr_local_outset
@sudo ${INSTALL} -m 755 -g wheel -o root "${<}" ${WORK_D}/usr/local/outset/on-demand
include /usr/local/share/luggage/luggage.make
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Sets Outlook to handle all mailto, ics, and vc links.</string>
#!/usr/bin/env python3
# Copyright (C) 2016 Shea G Craig
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <>.
"""Set Outlook as the Default Handler for mailto.
This script is intended to be run as the user to whom the change will
be applied. outset is the tool we use to run this at login time (as a
login-once script).
from LaunchServices import LSSetDefaultHandlerForURLScheme
def main():
result = set_mail_reader(OUTLOOK)
human_result = "succeeded" if result == 0 else "failed"
print("Setting Outlook to handle mailto links: {}".format(human_result))
def set_mail_reader(bundle_id):
"""Use LaunchServices to set mailto handler.
bundle_id (String): Bundle Identifier for the app to handle
mail. Caps do not seem to matter.
Integer return code (0 is a success) as per
return LSSetDefaultHandlerForURLScheme("mailto", bundle_id)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment