Get the unencrypted email password in Sage200Configuration table

Hi all, 

I need to send bulk email of reports every week, so I am planning to create a program that will generate a report and send an email by using the email setting on the Sage 200 configuration. The program will be schedule to run every week on Windows Scheduler

but the email password in Sage200Configuration DB > EmailServerConfiguration table is encrypted.

Is there any function in Sage 200 SDK to get the unencrypted password? Thank you.

Parents
  • 0

    There's nothing documented, but here's how you do it:

      // fetch the email config:
      Sage.MMSAdmin.DBSchema.Messaging.EmailServerConfiguration config = 
            Sage.MMSAdmin.DBLayer.ServerConfigurations.GetEmailServerConfiguration();
    
      //determine the encryption key:
      SecureString encryptionKey = Sage.MMSAdmin.Util.SecureStringHelper.StringToSecureString(
            config._EmailServerConfiguration[0].UserLogin + config._EmailServerConfiguration[0].ServerName);
    
      //decrypt the pwd
      string plainTextPwd = 
            Sage.MMSAdmin.Cryptography.SymmetricEncryption.DecryptText(
                        encryptionKey, config._EmailServerConfiguration[0].UserPassword);

  • 0 in reply to Chris Burke

    Hi Chris, which dll file that I need to import as reference?

  • 0 in reply to murni

    You'll need:

    Sage.MMSAdmin.DbLayer.dll

    Sage.MMSAdmin.DBSchema.dll

    Sage.MMSAdmin.Util.dll

    ..and there might be an indirect dependency on Sage.Web.Services.Framework.dll, I can't remember for sure.

    You won't find all of those in the loose assmblies that you get as part of the SDK.  You'll have to source some of them from the \bin folders of the Sage 200 Services that you'll find under inetpub.

Reply
  • 0 in reply to murni

    You'll need:

    Sage.MMSAdmin.DbLayer.dll

    Sage.MMSAdmin.DBSchema.dll

    Sage.MMSAdmin.Util.dll

    ..and there might be an indirect dependency on Sage.Web.Services.Framework.dll, I can't remember for sure.

    You won't find all of those in the loose assmblies that you get as part of the SDK.  You'll have to source some of them from the \bin folders of the Sage 200 Services that you'll find under inetpub.

Children