So below is the code for the Applescript I used
tell application "Mail" check for new mail -- instead of getting the unread count of inbox -