Ton of changes

email sending script
api script