WebMail Pro ASP.NET documentation

How to place banner ads

If you provide webmail service, there's a chance you'd like to display your own banner advertisement inside webmail interface. Changing layout is probably a no go as it would involve lots of code modifications. Fortunately, there's a couple of simple methods to display banner ads (or custom HTML code of any other kind) in WebMail Pro interface directly.

One of those methods is to put banner advertisement into message preview pane. If no message is selected, only banner ad will be shown, otherwise banner will be displayed beneath the message content. To achieve that, modify mail/message-view-pane.js file. There's a function called WriteMessageCont (Line ~233), you'll need to add the following at the very beginning of the function:

html += 'HTML code of your advertisement';

and it should look like:

    WriteMessageCont: function (html)
    {
        html += 'HTML code of your advertisement';
        if (this._msgViewUseIframe) {
            this._msgCont.contentWindow.document.body.innerHTML = html
        } else {
            this._msgObjCont.innerHTML = html;
        }
    },

Another convenient place for showing ads is a folder list pane, right below the list of folders. Add the following code in message-list-prototype.js file after line ~1355:

        var divAdSense = CreateChild(this._foldersPane.List, 'div', [[docs/'class', 'wm_folder']]);
        divAdSense.innerHTML = 'your advertisement code';

And that'll look like:

        } //for
        var divAdSense = CreateChild(this._foldersPane.List, 'div', [[docs/'class', 'wm_folder']]);
        divAdSense.innerHTML = 'your advertisement code';
        this.RepairToolBar();
        this.hideSearchFolders();

Please note that this might not work with advanced code utilizing JavaScript. Using IFrame might be a good idea in this case.