How to Build Buttons that call the Email Editor using the COM ASP API

Less than one minute read time.
This has article has been corrected and the code reformatted 17th October 2011.
I have written before about building buttons that call the inbuilt system actions. The action code for the internal email editor is 1500.

We can set up a new SendEmail button on a custom page that will either display the editor in
  • Full Screen
  • Split Screen or in a
  • Popup Window

The code below shows how to create the buttons of each type and add them to a block.


//Code to call a Full Screen Email Editor

var strFullScreenEmailButton = eWare.Button("fullscreen","sendemail.gif", eWare.Url(1500)+" &key-1=1 &newbtn=t");

//Note Key-1 contains the integer that represents the entity previously in context e.g. 1=Company, 2=Person. See other articles about the Key Values to learn more.
//Code to call a Split Screen Email Editor
var strScript = "javascript: x= parent.frames['EWARE_HIDDEN'].location='"+eWare.URL(1500)+" &newbtn=t &Frame=email'; parent.SECONDSET.rows='70,*,*,0,0'; parent.SECONDSET.frameSpacing=1; parent.EWARE_HIDDEN.noResize=false; void(x)"
var strSplitScreenEmailButton = eWare.Button("splitscreen","sendemail.gif", strScript);

//Code to call the Email Editor in a PopUp window.
var strScript2 = "javascript: x = window.open('"+eWare.URL(1500)+" &newbtn=t &Frame=popup','email','scrollbars=yes,resizable=yes,width=920,height=600'); void (x)";
var strPopUpEmailButton = eWare.Button("popupscreen","sendemail.gif", strScript2);

//Add Buttons to Block
var myBlock = eWare.GetBlock("myscreen");
myBlock.AddButton(strFullScreenEmailButton);
myBlock.AddButton(strSplitScreenEmailButton);
myBlock.AddButton(strPopUpEmailButton);

The button code here can be adapted for use in the .NET API.