Retrieving "Sender Address" via HSL or C#

Hi Everyone,

I’m building a C# .net class library for sending emails. I would like to retrieve the “Sender address” parameter stored in Venus.

I think I’ve tracked down the value as being stored in the HxServices.cfg file under the property “DefaultSenderAdddress”. Is there a way to retrieve this value either in HSL or directly inside my C# class library? I’m thinking that I might need to reference and use the HxCfgFil type library within my class library - but I’m not sure how to use it to retrieve the value.

Is anyone able to point me in the right direction please?

Many thanks in advance,
Will

Hi @WillEb,

There is a default library in VENUS called HslUtilLib which contains a function called “GetEmailAddressOfSender”. Looking at the HSL code for this library/function shows the following:

		object mailSettings;
		mailSettings.CreateObject("Hamilton.HxServicesEmail");
		return(mailSettings.SenderAddress);

This should handle what retrieving the default sender address.

Thank you,
Dan

2 Likes

Aha! Thanks @DanHartman_Hamilton

That’s given me the way in that I needed - thank you :slight_smile:

I referenced c:\Program Files (x86)\Hamilton\bin\Hamilton.HxServices.dll in my C# class library.

Then I was able to set up the following code in C# using the HSLUtilLib to help join the dots:

        public string DefaultSenderAddress()
        {
            var defaultSender = new Hamilton.HxServices.HxEmail();
            return defaultSender.SenderAddress;
        }

Finally, in my HSL library I could run that function to pull in the sender address.

    // Function declaration
   function DefaultSenderAddress() variable
   {
      variable action;
      variable strReturn;
	   action = GetFunctionName();

      // Create an instance of the COM object
      comObject.CreateObject("EmailCOMLibrary.Email");

      // Call the method and store the result
      strReturn = comObject.DefaultSenderAddress();

      return(strReturn);
   }

I realize that I could have just used the code from HSLUtilLib directly - but I wanted to understand where the function was coming from.

Thanks again for the help!
Will

3 Likes