- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 03:50 AM
Hi All,
I have one requirement in the email inbound action script, I want to get hostname from the url as below.
In the email, as below url will be provided.
How we can achieve this.
Expected HostName
https://www.google.com www.google.com
http://www.google.com www.google.com
https://www.google.com/ www.google.com
http://www.google.com/ www.google.com
Thanks
Shantanu B
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 04:34 AM
If you can get the url from the email, you can try it with something like this:
function extractHostname(url) {
var hostname;
var url = [your way of getting url from email];
if (url.indexOf("://") > -1) {
hostname = url.split('/')[2];
} else {
hostname = url.split('/')[0];
}
hostname = hostname.split(':')[0].split('?')[0];
return hostname;
});
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 04:34 AM
If you can get the url from the email, you can try it with something like this:
function extractHostname(url) {
var hostname;
var url = [your way of getting url from email];
if (url.indexOf("://") > -1) {
hostname = url.split('/')[2];
} else {
hostname = url.split('/')[0];
}
hostname = hostname.split(':')[0].split('?')[0];
return hostname;
});
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark