3
Views
5
Comments
How to add url of site in mail
Question
We want to inform a user with a mail that he need to go to the site of the application.
How do I get the URL of the server ?
I know there is GetUrl() but this does not return the server or domainname
I only get the location of the eSpace.

Comparable to what you do with the daily digest, there are links to www.outsystems.com/network and then to specific page.
2020-03-19 14-14-27
Pedro Gonçalves
Staff

Hi Joop,

 

To obtain the URL of the server you can use GetURL(), but this will only work if you're making a request to the application, since GetURL action is based on the HTTPRequestHandler. If that is the case - say, you send the email on the click of a button - then don't forget to parse the server from what GetURL() returns.

 

On the other hand, as is the case of the daily digest which is usually initiated by a timer, the URL returned by the HTTP request will always be 127.0.0.1. You have 2 workarounds:

  • Simply create a site property that holds the server name and append it to your email address;
  • If this is an internal application, and all your users are able to access the machine's network name (example: devserver01) then create a new extension that returns the .NET Framework System.Environment.MachineName property and you'll get the server name.

Hope that helps,

Pedro

2016-08-25 18-41-23
Lúcio Ferrão

Hi Joop,

 

In version 4.x, the best way specify the domainname (to pass to richmail, I assume) is to place it in a Site Property and define it once for your application. It is how we handle it for the network forum email notifications.

 

Cheers,

Lúcio Ferrão

2011-06-15 10-51-22
Joop Stringer
@Pedro:

GetURL() doesn't return the domain like https://<server>/<eSpaceName>. It only returns the eSpacename of the application without server/domain name. So we'll end up in using a site property.

Thanks.
2020-03-19 14-14-27
Pedro Gonçalves
Staff

Hi Joop,

 

Are you sure you were using GetURL action from HTTPRequestHandler? Maybe it's another version.

Here's a sample eSpace that returns the output from a button submit and from a timer - check out the differences.

 

Cheers,

Pedro

TestGetURL.oml
2011-06-15 10-51-22
Joop Stringer
Pedro,

We need to also have this available from a timer ... we solved this by a site property :-)
Thanks
Joop
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.