CapTech interview question

creating a function for a mail system