Mail-in database - lotus-notes

I have this scenario (this is an old story of mail-in)
This is a company where have many Domino Mail-in databases. One for every branch.
Every person in every branch has a personal Notes Email.
The company policy is that each person of the branch can not send email to an external account (internal yes), so I need to use the mail-in database.
I tried with the rules of Domino to perform a block (in the rule you can set the Sender field to track the mail), but it does not seem possible because unfortunately, when a user sends an email from a mail-in database (mail9.ntf template) the sender field is the username.
I know about Team Mail box project, but this is an old project and I have some problems with HTML outgoing mail and it doesn't work on the web.
I tried looking for a solution, customizing the standard Mail9.ntf template and I discovered that the library "CoreEmailClasses" with the function QuerySave method is executed Me.m_noteUIMemo.Send()
I have tried to change this code copying the backend document into mail.box the mail...but this doesn't work because it is more complicated (there are TMP field...and I observed that when you use .send() into mail.box the RichText is a MIME-RT) .
The only solution that I have found is to save the email and later with a scheduled Sign Agents to Run on Behalf Of the mail-in user that sends the email (solution that I do not like because is not in realtime).
Do you have any other ideas?
UPDATE FOR INOTES
I've found into the FORMS9_x.nsf the subform
Custom_MailMemoDictionary_Lite that contains this code. Now I need to understand how to use it
<NotesComment>
//Use s_MDNToFrom to change the From field in outgoing email. If
//s_MDNToFrom is set, need to also provide From field. Uncomment out the
//dictionary to enable this
</NotesComment>
<NotesComment>
<NotesDictionary>
<notesvar name=s_MDNToFrom value={"1"}>
<notesvar NAME=From value={"Custom From Field"}>
</NotesDictionary>
</NotesComment>

I am not sure if this will solve your problem but we have found that setting the Mail-in name (item name FullName) in the Mail-in Database document to a hierarchical name allows us to setup the owner of the mail-in database as that user. Then mail sent from that database is from the mail-in name sent by the actual user.
For example: use a name like: Branch1 Email/Organization and set the internet email to branch1.email#oraganization.com and then set the owner of the target database to Branch1 Email/Organization
Good luck!

deletes the contents of the subform and paste the following code
<NotesDictionary>
<notesvar name=s_MDNToFrom value={"1"}>
<notesvar NAME=From value={Principal}>
</NotesDictionary>
kind regards

Related

Best way to change the sender name?

My environment is configured for Directory Assistance so users from our LDAP can also authenticate to our Domino applications.
The issue I have is that the the current user that is returned has this format:
uid=abc#mail.com/ou=customers/DC=ACME/DC=COM so when
emailDocument.send()
is triggered; the From feld gets populated with this value and the SMTP communication fails when doing the domain lookup with this message = Data format error
I'm using emailBean from Tony McGuckin for sending emails.
Is there an alternative way to change the Sender name like noreply#mycompany.com?
I'm trying to avoid to create the message directly on mail.box.
Depends on what your use case is:
You want to have "proper" eMails individually per user
The application sends out eMails with a single sender name
In the first case an address book entry for your users is needed where you can map the external name to a proper Full name and eMail.
In the later case: use creation in the mail.box. It's your best option

Plugins for incoming and outgoing emails in CRM 2011

I need to create two plugins for CRM 2011
Whenever an email is incomging or outgoing I need to check if the email has any attachments in it. If yes I need to set one boolean value to true.
When user (user only, not workflow or automatic message etc.) answers some email I need to fire a plugin that checks incident's status (email is regarding to an incident) and depending on the status do some things.
I'm not really familiar with this whole email tracking concept. We have an email router configured, but that's all I can say.
What are the steps that I need to use in order to achieve plugins described?
For the first plugin I think "Create of email" is enough, right? What about the second plugin and how can I make sure that plugin is fired only when a real person sends an email?
For the first plugin:
To check for attachments for an email you will need to create a plugin which executes on create of the ActivityMimeAttachment entity, which is the entity which stores email attachments.
When an inbound email is processed by the Email Router (or tracked in the Outlook Client) the parent Email record is created first, and then an ActivityMimeAttachment record is created for each attachment.
If you try to check for attachments when an Email is created it will be executing before any attachments are created. However, you may also need a plugin to execute when an Email is created to set the 'Has Attachments' field to false.
The plugin on ActivityMimeAttachment will need to get the parent email activity and set the 'Has Attachments' field to true. This will handle both inbound and outbound emails.
Also note that for 100% accuracy you may need to consider the scenario of a user who is writing an email and adds an attachment, and then deletes it. This could be handled by a plugin running when attachments are deleted, but that logic can get complex (what if two attachments were added but only one was deleted?)
There is some useful sample code for dealing with the ActivityMimeAttachment entity here.
For the second plugin:
A plugin which executes on update of an email would then need to validate the following criteria:
The email direction is outbound (a user has answered an email, e.g. sent a reply)
The email status reason is Sent (the email has actually been delivered and is not saved as a draft)
The email sender and/or owner and/or created by is a real user (filter out automatic and workflow sent emails)
The regarding object is an incident
Then you can implement the required custom validation and logic.
The second item could potentially be achieved using a standard workflow, depending on how complex the custom logic is. If the logic is too complex for a standard workflow, a custom workflow activity might also be useful since additional logic or validation could be added without writing additional code.
For the 1. Plugin: Register on email create and on update (maybe users create the mail first and then update some attachments later)
For the 2. Plugin: Check the following:
plugin context depth should be 1 (this makes sure that no mail created by another plugin is processed)
Check the created by and created on behalf by fields on the email entity to be a non technical users and that no one is acting on behalf of another user creating this mail
Check that regarding object points to incident
If this is not sufficient enough and the users sends mails only via CRM Web GUI you can additionally set a special flag on the record via javascript to make sure that the mail was created using the gui. Than check this status flag in the plugin.

How to make an emailed document form make changes to my local database?

I have this sample application regarding Change Requests.
If the form is saved, it will send a form as an email to the listed approvers.
The form has 2 actions - Approve and Reject.
Let's say the approver approves the CR. It will update the emailed form document but the document that resides in my local database won't. Is there a way for me to update the documents in my local database automatically if the recipient(approver) has approved/rejected the document form?
Not automatically, but you can add logic to the approve and reject actions to update the database.
If this database is shared on a server, one way would be to make it a mail-in database. Your approval actions could then trigger an email that goes to that mail-in database address. Your database would then need an agent to process the emails, perhaps simply just parsing the subject line which could contain the UNID or some key that says which document to update along with the response of approved or rejected. This would work in a distributed environment.
If the environment is not distributed, say everyone is always on the same network connected to the same Notes server, then you could write some Lotusscript code to update the remote database directly.
Remember the context that you'll be in. When the emailed form is open in an approvers Notes client, he or she doesn't have access to your local databases. So you'll need to have a place on the server that the response action can update.
The safest design for a highly distributed workflow application, (replicas on multiple servers and local replicas on users laptops) is to have the approvals and updates posted as new responses and not have updates directly to the main WF document. The WF document should then compute the statues based on the responses. Finally, an agent running on ONE server can post the status updates to the document and archive the responses.
This construct will eliminate (or reduce significantly) the possibility of replication and save conflicts. It is particularly needed for WF items that require multiple approvals from people who are disconnected or connected to different servers.

Mail sent from iNotes to custom mail in databases duplicate when edited and saved

This is a very odd issue. When sending a standard email from the iNotes client to a mail in database it will duplicate an exact copy if edited and saved. This behavior does not exhibit itself when editing and saving an email to a notes mail client. The sending mail templates are the current design and the servers are 8.5.3
Has anyone seen anything like this?
Check the design of the mail-in database. Specifically, check the properties of Memo form in the mail-in database, and see if the Versioning property is set to anything other than 'None'. (If you have an agent that is changing the form from Memo to something else, check that form instead.)
Also, turn on the LotusScript debugger, go through the edit/save process, and see what scripts are executed. I seem to recall that some versions of the standard templates used scripts to implement versioning instead of relying on the form properties.

Is there anyway to Extract the Particular User's Contacts Using the user's nsf file?

In Lotus Notes For Every User there is one nsf file will be created with the userid name as a file name. I want to Extract the Contact details using that nsf file Using Java Lotus Notes API.. (If my userid is user1 means the nsf file created in user1.nsf).. Is it possible to extract all the contacts of that user using the user's nsf file?
The tricky part here isn't reading the contact documents, it's finding the database itself. Depending on the installation, the contacts could be either on the server or local on their workstation.
If you're running from a server agent, you can only access the databases on the current server, or another server your credentials have access to. However, sometimes by default the user's contacts are put into a local database on their workstation and you can only reach them from code running in the user's context.
If that's the case, you have no choice but to find a way to run something on each user's workstation. You could
a) have the user replicate the names.nsf to the server, or
b) synchronize the contacts using the mail action.
For "a", you might send a special email with a LotusScript button in it to automate the replication. I've seen that method used in email migrations when using Quest software's migration tool, and it works well.
For "b", if you have a recent enough version of Notes you may follow these instructions to enabling the sychronize contacts task on the replicator. Ohterwise you'll need to instruct the users how to synchronize contacts using the actions menu. One the contacts are synchronized, a copy of the contact information will be contained in the user's mail file, which will be available on the mail server. You can then simply access the contacts view to read the documents.

Resources