Mail Sender Plugin |
A mailsender plugin is a COM component that implements a specific interface. By accessing this interface, CRM 5 may "talk" to the plugin. This description will explain how to make a mailsender plugin in Visual Basic (VB). The approach will be somewhat different for other programming languages, but the concepts are the same. Start VB and create a new ActiveX DLL project. Open the 'Project' tab in the menu. Choose 'References'. Click 'Browse'. Locate the file 'sender.tlb' (zip file).Open it. Your project should now have knowledge about the mailsenderinterface CRM 5 provides. In top of Class1 (the default name for the first Class Module) write the following statement: 'Implements SOMailSender'. This is the interface CRM 5 expects to find, and use in your plugin. By selecting the 'SOMailSender' object in the top left dropdown, you will get a list of all the methods in the top right dropdown.
Capabilities | should return what your plugin can and can not do |
DoFullNewMail | should implement a way to send a new mail |
DoFullForward | should forward an existing mail |
DoFullFaxDoc | should send the given document by fax |
DoFullReply | should reply to an existing mail |
DoFullSendDoc | should send the given document by mail |
DoSendModel | should generate an e-mail from the given mailmodel and display it |
DoSendModelNoGui | should generate an e-mail from the given mailmodel and send it |
FormatMailAddress | format the mailaddress to a format your application can use |
When the passed variable to the function is of type long, it is a document_id from CRM 5. You may use the CRM 5 SDK to get more information about the document if needed. Find more information about this in the CRM 5 SDK documentation.
One method that differs from the others is 'Capabilities'. This method will be executed during startup, and is used to determine what kind of "services" your plugin can offer.
To implement it, create a new Class Module(Class2). Write the following at the top: 'Implements SOMailCapabilities'. This is the interface CRM 5 uses to determine what your plugin can, and can not do. Implement the methods by returning true or false, based on what you want your plugin to handle. Back in Class1's 'Capabilities' method, return a reference to a new instance of Class2. Voila, you have just made a new mailsenderplugin for SuperOffice SIX. All that's left is to add a few keys to the windows registry, so that SuperOffice can find it. To do this you need to add an entry to the the following area: HKEY_CURRENT_USER->Software->SuperOffice->Mail->Senders Create a new key with an appropriate name. Add a string entry with the CLSID of the COM object, and an entry with the default file extension the plugin handles. For Outlook this will be .msg files. Example of key
HKEY_CURRENT_USER->Software->SuperOffice->Mail->Senders->OutlookAddin
CLSID | REG_SZ | {DAAD094C-8096-4829-9DF7-95461754EECD} |
FileExtension | REG_SZ | msg |