Eliminate server name from from "From" field in documents sent through the Agent - lotus-notes

I've an agent which runs everyday and sends email notifications. I'd like that it will run on behalf of specific user, for example "Joe Waker/New Yourk/BTC" and this name will be displayed in field "From". But when agent sends mails it appears as "Joe Waker/New Yourk/BTC#SERVERNAME", how can I eliminate this #SERVERNAME and leave only "Joe Waker/New Yourk/BTC"?
I've tried to change value of field Principal and change value in properties of agent in field "run on behalf on", but didn't success.
If anybody know the solution please share, thank you.

You could simply run the agent using your regular application signer ID (the one you use to sign all your production code), and use the trick of depositing the mail directly in mail.box. Then you can set the "from" field to anything you like.
You can take a look at my mail notification class here:
http://blog.texasswede.com/lotusscript-mail-notification-class/

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

Tuleap-edit email notification content

Where to edit the default mail notification content in tuleap. for eg) There is a field called "Name" which is visible(has permissions) to all users in tuleap but we need to remove the same field in mail notification content which hits the users at the time of Add/update happen in the task.
Could you be more precise on what you are trying to hide? Normally, you set appropriate permissions on fields you don't want to be seen by certain users and they will not appear in mails for them.

Mail-in database

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

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.

Lotus Notes R5 email formula

I currantly have a simple agent running for forwarding email to an alternative email address, unfortuately the formula's i have tried for also keeping the subject have failed. the subject come in as the server it was sent from.
last code tried
"[" + #Implode( SendTo; ";")+ "] " + Subject
I agree that it would help if you post some code, but I'm going to take a stab at this anyway. I'm guessing you mean to say that the sender appears as the server it was sent from. That's a common gotcha when sending email from agents. The agent is running on the server and uses the server's context to send the email.
The fix in R5, I believe, is to sign the agent with another id. You'll have to make sure this Notes id has rights on that server to run agents and has at least designer rights to the database that holds the agent.
I'm still using R6 and there is a field in the Agent properties called "Run on Behalf Of", where you can choose a user and have the agent run in the context of that user. I can't remember if that's available in R5, but the trick above essentially yields the same result.
I guess your problem could be avoided by setting the field Principal to the original sender.
Is there any reason why you are developing your own agent instead of using the built in functions ("Forwarding address" in Domino Directory) or "Mail Rules" in the mailbox?

Resources