Common script for email generation