Get Domain Name From Email Java. Decide on a domain name extension. I want to get the domain part from an email address in Javascript.
UrlgetHost returns the domain name for the given URL addressHere is the example code of GetDomainNamejava as. You can get the sumdomain name without the top-level domain ex. HostnameCanonical addrgetCanonicalHostName.
Assuming you are sending email from localhost String host localhost.
A free domain registration for a new or transfer domain is included with your first year of hosting. String strDomainNamehostnameCanonicalsubstring hostnameCanonicalindexOf 1 hostnameCanonicallastIndexOf. I am writing a script that will check the domain name and print the name of the domain. Get the default Session object.