implement ipEmailTemplate function