Register | Login  
 
Blogs Minimize

Current Articles | | Search |

Send one email to all addresses from Newsletter (Send Method to include TO: Distribution List)

This blog is a response to a customer who asked for direction on how to modify the UserManager source code to allow sending a single email to multiple addresses in the To list.  For more detail about this request, see the Support Forum.

The user control to display the Newsletters screen is BulkEmail.ascx.  This control is in the folder [DNNROOT]/DesktopModules/WorkControl-UserManager.  The code behind of this control is BulkEmail.ascx.vb which is in the same folder.  The resource file for user control BuilEmail.ascx is the file BuilEmail.ascx.resx and it is in the folder [DNNROOT]/DesktopModules/WorkControl-UserManager/App_LocalResources.  The class library supports sending email is [DNNRoot]\Library\Components\Mail\SendTokenizedBulkEmail.vb. 

Step 1 -  Add checkbox to indicate sending one email to all addresses.

 

Add following below the NoDuplicates section in BulkEmail.ascx:

    <tr valign="top">
        <td class="SubHead" width="150">
            <dnn:label id="plOneEmailPerAddress" runat="server" controlname="chkOneEmailPerAddress" suffix=":" /></td>
        <td width="325">
            <asp:CheckBox id="chkOneEmailPerAddress" cssclass="Normal" runat="server" Checked="false" /></td>
    </tr>

image

Add following code to the resource file BuilEmail.ascx.resx

plOneEmailPerAddress.Help    Check to enable sending one email to addresses.  Default is not check   
plOneEmailPerAddress.Text    One email to all addresses    

image
The "One email to all addresses" will display under the "No duplicate addresses" on the Newsletters/Advanced Settings image

 

Step 2 - Modify the send email code to send one email to all addresses

Copy the SendTokenizedBulkEmail.vb to project library WorkControl.UserManager.  Customize this class to build a semi-colon  delimiter of email addressees.

In this class, look at the Function "Recipients".  Suggest to use a stringbuilder class to build the distribution list.

In the Function SendMails, user the distribution list to send out email.
image
In BulkEmail.ascx.vb, if "One email to all addresses" is checked, call up the send email method from the SendTokenizeBulkEmail.vb in the WorkControl.UserManager project library (instead of the CORE class)  

As a general guideline, suggest not to modify the DNN CORE code so you can upgrade DNN with minimum impact to the custom module.

posted @ Thursday, May 01, 2008 8:11 PM by Technical Support (Robert T.)

Previous Page | Next Page

COMMENTS