You don’t need a domain, but having one gives you credibility and makes registration easier.
technically you can register an app for OAuth2 with most providers like Google without owning a custom domain. But it's often smoother with a domain, because:
Providers like Google might treat domain-less apps as “less trustworthy”
Users get warned with scary security messages
You may not be able to set up branded consent screens
So, you can go domain-free... it just means you might have to live with a few restrictions or workarounds.
Will app registration work for others using your app?
It depends on the provider and how you register:
If you register your app and embed client ID/secret in your code, you could allow others to use your app's credentials to send emails.
However, that's usually not safe—those credentials could get abused or leaked.
A better model: build the app so users authorize it themselves (via OAuth2), and store their tokens securely.
Apps like Thunderbird do this: they register themselves as a trusted application with providers like Google, then walk users through OAuth login. Each user gets their own token, and the app doesn’t need to know your password.