modified email sending to use dynamics entries from db