views:

281

answers:

2

In a custom DotNetNuke module, I want to be able to send emails based on a tempalte. I will want to be able to inject text values for certain template parameters. I also want the site admins to be able edit the email contents. I want the admins to be able to the layout and text in a fairly foolproof way.

One solution is to use localization string to allows customization of the email contents, which email structure hardcoded somewhere. This is undesireable as it does not allow the admin to modify the layout.

Another solution is to have Text/HTML modules set up to contain the email contents. This has the benefit of allowing the admin to edit the text and layout. It has the drawback that the admin might use a style that is in the CSS stylesheet that wouldn't be accessible to an email reader.

Any other thoughts on how to do this? A 3rd party plugin or module would be fine. For the email modules I've reviewed, they're more about setting up email campaigns. For the ones I saw, I was not sure I could send emails programmatically from my custom module.

thanks

+2  A: 

If your email template can be less than 2000 characters I would suggest using the module settings to store your data. You can do this on the standard Settings.ascx control my overriding the UpdateSettings method. The 2000 character limitation is based on the TabModuleSettings.SettingValue database field size.

    public override void UpdateSettings()
    {
        try
          {
            ModuleController objModules = new ModuleController();
            objModules.UpdateTabModuleSetting(TabModuleId, "EmailTemplate", this.txtEmailTemplate.Text);

            SynchronizeModule();              
        }
        catch (Exception exc) //Module failed to load
        {
            Exceptions.ProcessModuleLoadException(this, exc);
        }
    }
To clarify: Step 1) Create Settings.ascx 2) Inherit from ModuleSettingsBase 3) Override UpdateSettings (as above) 4) Add Settings.ascx control to module definition with the key "Settings" - this will ensure that your settings page gets incorporated into the module's overall settings page.
Ian Robinson
+1  A: 

Personally there are a few options.

  1. Localization file. This is actually easily modified by site administrators, via Admin -> Languages. However, this is a per-portal customization.
  2. Module Settings, but you are VERY limited with the 2000 characters, but can let users modify based on the mdoule.
  3. SQL or File based, allow them to customize as needed, and give a simple way to upload/download/manage.
Mitchel Sellers