Modify sync requests to use long polling. Modify mail sending to use local SMTP server instead of sendmail.