Add email_via setting.

Also some house cleaning.