How to hook 'send email' of IBM Lotus Notes - email

I'm working on a plugin for IBM Lotus Notes. I need to change content of an email right after user clicks 'send email' button, before the email is actually sent. I have searched APIs of Lotus Notes but can't find a workaround. There is a library named com.ibm.notes.mailsend in folder /opt/ibm/lotus/notes/framework/shared/eclipse/plugins. But I can't find any document related to it on Internet, and have no idea how to capture event about sending email. Does anyone know how to implement the function that I need? Thanks.
Update: Thanks Richard. Basically I've figured out how to hook email sending. But I also need to make an option that user can set differently for each individual email. From my understanding, email known as message is stored in Mail File database before being sent. How to 'add flag' to the message? Thanks.

The way to hook events in Lotus Notes is with the Notes C API's Extension Manager routines. The general strategy for hooking mail send operations is to set up a hook on EM_NSFNoteUpdateMailbox. This can be done on either the Notes client or the Domino Server. On the server side, if your processing is non-trivial, you run the risk of slowing down Domino if you try to do all of the work in your hook, so the strategy most people adopt is to have the hook code change the status of the message to "On Hold" and then signal a separate server task to take over the work. That way the hook can return and the separate server task can take whatever time is needed before resetting the status of the message so that normal routing will take over. You can find documentation here.
For server-side processing only, there are two options that will allow you to write your code in Java instead of C. One is an OpenNTF project called TriggerHappy that allows you to write Java Agents that are fired when some boilerplate hook code is triggered, and the other is the OpenNTF version of the Domino OSGi Tasklet Service (aka DOTS), which allows taskets to be fired in response to EM events. Note that there is an IBM-supported version of DOTS that is shipped in Domino 9 "Social Edition", but my understanding is that it does not include the EM event support.
Updated for additional info requested...
In order to add a flag to each message that can be read by the code that runs in your hook, you need to modify the mail template that is used in the users' mail files. You will need permission from the Domino system administrators to do this, and to be blunt: this is not something that Domino adminisrators like to do because it makes their job more difficult when they are upgrading Domino versions. There are many ways you could modify the template, but the point of all of them would be to add a new hidden field to messages which would serve as a flag for your hook code. If the field exists, your code would do the changes to the content that you need, otherwise it would leave the content alone. One possible way to do this would be by adding a shared action containing a formula to set your hidden field (that formula is just something like FIELD myFlagFieldName := "1";) and then you can add that shared action to the Memo form. Users would press the action button any time they want to trigger your code. The admin would need to maintain backup database containing your shared action and re-add it to the mail template after every upgrade and then re-add it to the new template version's Memo form. Of course there are other ways as well, some that are more friendly to users but harder for admins to deal with, and vice versa.

Related

Create Outlook Form or Template with required fields in body and an Approval button

I'm tasked with creating an Outlook form that will be used to communicate rate changes to our customers, and ask for their approval. The body of the email must have some fields that are required by the sender, such as customer name, and new rate. And the email must have an approval button or similar from the recipient. Its a relatively basic workflow
As I'm researching Outlook forms, I discovered this might be better suited for Outlook templates instead. But I'm new to this, and I'm not sure the difference between the two.
Any help or advice would be much appreciated!
Custom Outlook forms should be displayed on both sides of communication if you really want them working correctly. It is very inconvenient, so this feature is not really used nowadays.
Instead, you may consider using the MailItem.VotingOptions property which returns or sets a string specifying a delimited string containing the voting options for the mail message. This property uses the character specified in the value name, sList, under HKEY_CURRENT_USER\Control Panel\International in the Windows registry, as the delimiter for multiple voting options. As a result the recipient will see possible options to choose on the UI.
When the response comes back you may check the MailItem.VotingResponse property which returns or sets a string specifying the voting response for the mail message. This property is usually set to one of the delimited values returned by the VotingOptions property on a reply to the original message.
And the third solution is to develop a COM add-in which can handle custom data and provide a convenient UI for voting, for example, a custom form region can be developed for that. Again, this solution, like custom Outlook forms, requires installing the software on both sides of communication.

CRM 2011 custom Plugin passing parameters to processes

We are trying to automate a few things in CRM and I have an idea about how to go about it while still allowing customizations from the Process section in CRM Settings.
The problem: We receive a lot of E-mails from an account that are added to a Queue. This queue fills up faster than we can clear it. Most of these E-mails have a standard format and the user only has to read a few lines of the the E-mail body to figure out what to do. There's a total of 6 different workflows that the user would do. These haven't been implemented.
Reading the documentation of CRM, I figured that I would need a custom Plug-in that would parse the E-mail body, and trigger a workflow in CRM according to the values in the E-mail. I also need some of the values that the E-mail contains to be passed to the workflow. I already have the Plug-in setup to do this.
The problem I run into is creating a process which takes in custom parameters passed over by the Plug-in I created. I need to access these values in the front-end (one of the Processes in CRM Settings). Is this possible? If not, is there another way to achieve this?
Is there a reason you used a Plugin to kick-off this automation instead of a Custom Workflow (which is a Process)? You could perform the parsing of the E-mail inside your Custom Workflow, and use its InOutArgument properties to pass values into subsequent child workflows.
Definition: https://msdn.microsoft.com/en-us/library/gg327984(v=crm.5).aspx
Sample: https://msdn.microsoft.com/en-au/library/gg334455(v=crm.5).aspx

SugarCrm - How to send e-mail to manager every time a Lead is updated?

I'm new to SugarCRM.
I've google but I can't find a solution for this. Every time a Lead is UPDATED (New Log Call, New Email Attached, New meeting, Status Change) I need to send an e-mail.
How can I do this in SugarCrm?
Best Regards,
André
While the benefits of blasting a person with an email upon every update can be argued against, what you will need to do is use an after_save logic hook on the Leads module. Within that hook you would then send an email if it is an existing lead.
Helpful links:
http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_7.6/60_Logic_Hooks/20_Module_Hooks/after_save/
http://developer.sugarcrm.com/2011/02/14/howto-detect-record-state-in-a-logic-hook/
http://developer.sugarcrm.com/2011/03/01/howto-send-an-email-inside-sugar-thru-code/
If you are using professional version you need to create a workflow and customize the email template (everything using sugar interface in admin panel).
If you are using the community version you need to create logic hooks file and create you logic manually. I suggest you create one $old_lead in before save hook and compare this $old_lead with actual $bean and see if have one changes.

Magento Transactional Email config: best practice

Every time I set up a Magento store I must spend an entire day setting up the stupid transactional emails since they are so weak by default.
Half of that time is spent just loading the templates into the backend and clicking around with Magento's user interface...
Is there a straight forward method to load all the emails in one sql statement or similar?
Have any of you found a way to quickly edit all the templates outside of Magento?
Any comments on the email templates adapter extension (or similar)?
Please read about Magento Setup Resources
You can then update your email content/configuration using update scripts in dedicated module, for ex.:
app/code/local/{project_prefix}/ConfigurationEmail
Magento allows you to run update scripts, so you could export the initial setup work and create an EmailSetup module. Note that you would also want to set the appropriate config data to link transactions with the DB emails.
We've made some shell scripts to make regular changes, many of which were obviated by changes which Magento made.
Not familiar.
You should try the Transactional Email extension from Comfirm.
It makes handling transactional email in Magento a lot easier.

Set a review date on a sharepoint 2010 document

In sharepoint 2010 I need to be able to set a review date on a document and be emailed when this review date is reached. Is this possible?
Thanks for any pointers
I would create a very simple Workflow for this. You could just fire up Sharepoint Designer, create a small Workflow which checks whether the document in question has been reviewed and otherwise send an e-mail or a task to some person.
Try out Sharepoint Designer & Workflows if you haven't done so. Reminders are a very easy thing to do.
This answer details a few different ways to do this - workflow, scheduled jobs, open source and commercial add-ons.
Dated reminders in sharepoint calendars
To make it the most robust solution, I would suggest to customize the Alerts framework of SharePoint. SharePoint allows following customizations (as documented here http://msdn.microsoft.com/en-us/library/bb802949.aspx)
Adding or removing buttons from the
alert e-mails.
Changing the cascading style sheet
used to format e-mail alerts. This is
particularly useful for sites that
want to create a consistent
appearance.
Changing the latency of "immediate"
alerts by adjusting the default timer
interval.
Override the templates used to create
e-mail or SMS alerts, either by
creating a new template or by setting
the SPList.AlertTemplate property.
Creating custom filters by using Collaborative Application Markup
Language (CAML) queries in the
element in the alert
templates.
Programmatically setting or changing
the mobile messaging service provider
(MSP) that forwards SMS alerts to
mobile telephones.
Adding custom event handlers that
respond when a user creates or
modifies an alert. Also, custom
handlers that respond to the alert
sending event can be created.
Programming the alerts framework by
using the SharePoint Foundation
object model. For more information
about how to customize alerts
programmatically, see SPAlert.
If your list supports sending alerts based on a View, you are lucky, A NO CODE SOLUTION is already there for you. You can create a View with filter condition like "DueDate is equal to [Today]" (and possibly "AssignedTo is equal to [Me]) and then subscribe to any changes to that view.
If you end up with custom alert filter, following links may get you started:
http://egrimmett.wordpress.com/2008/01/17/custom-alerts-part-2-filters/
Link