Create new API endpoint for email optin

This PR mirrors https://github.com/edx/edx-platform/pull/6060

Except this will merge to master instead of my model update branch, which has already been merged to master.