Implement setting custom domainname for getDefaultEmailAddress

This is a fix/implementation for  #2499

Any comments are welcome.