can i determine who's signed in to the native mail app?

kashaguilfoyle
New Contributor

Is there a way to create a group or report that will let us know who is signed in to the mail.app? 

We are in the process of implementing something new that we need to get this number for. I saw something about creating an EA but as a new JAMF admin, I'm still hesitant on if this is correct.

 

Any help is appreciated.

1 REPLY 1

kgam
New Contributor III

I made the following extension attribute to display the default mail client but stopped using it again as I didn't find it 100% reliable. But maybe you can find some inspiration in it or have more luck using it.

user=$(/usr/bin/stat -f%Su /dev/console)
plist="/Users/$user/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist"

if [ -e $plist ]; then
    client=$(defaults read $plist |grep -B 1 mailto |awk -F"\"" '/LSHandlerRoleAll/ {print $2}')
    if [ "$client" = "com.microsoft.outlook" ]; then
        echo "<result>Microsoft Outlook</result>"
    elif [ "$client" = "com.apple.mail" ]; then
        echo "<result>Apple Mail</result>"
    else
        echo "<result>N/A</result>"
    fi
else
    echo "<result>N/A</result>"
fi

exit 0