first function working fine, now to this email func.