add missing braces

Close missing brace for nested if statement
proper field check

check the proper field value "enabled" to see if messaging is enabled - not if the record exists in the database.