Applescript to send email messages to the persons with specific in interest and with at least one email address
You did not include the replaceName(mailBody, theName) handler, so I could not test the full script, however to fix the current error you need to modify the existing code.

Change:

repeat with i from 1 to number of items in theRecipients
    set theContact to item i of theRecipients
    set theName to name of theContact
    set theEmail to email of theContact


To:

repeat with i from 1 to number of items in theRecipients
    set theContact to item i of theRecipients
    tell application "Contacts"
        set theName to name of theContact
        set theEmail to value of email of theContact
    end tell