including string in message body

Hi,
i want to program an agent that automatically include a string of text in the message body when a message is sent to a certain email address.
Can you give some hints and code to do this? (My skills in LotusScript are very poor)

thanks in advance,
Pedro.
pedro011197Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GunsenCommented:
Then u could make an agent in the receiving mail database, trigged by "when new mail has arrived".

Sub Initialize
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim view As NotesView
     Dim collection As NotesDocumentCollection
     Dim memo As NotesDocument
     Dim reply As NotesDocument
     Dim Answer As NotesDocument
     Dim j As Integer
     Set db = session.CurrentDatabase
     Set collection = db.UnprocessedDocuments
     For j = 1 To collection.Count
          Set memo = collection.GetNthDocument( j )
          If (memo.Form(0) = "Memo") And Not (memo.hasItem("ReplyDone")) Then
               memo.ReplyDone = "True"
               memo.Subject = memo.Subject + " - updated by agent"
               Call session.UpdateProcessedDoc( memo )
               Call memo.Save (True, False)
        End If
     Next
End Sub
0
HemanthaKumarCommented:
Hi

You may have to modify ur memo form for this i.e. in the Template.

In Querysave event of the Memo form
include your agent to be run
======
Dim session as New NotesSession
Dim db as NotesDatabase
Dim agent as NotesAgent

set db = session.CurrentDatabase
set agent = db.GetAgent( "ModifyBody" )
Call agent.Run
=====

The agent ModifyBody will look like this
====
Dim ws as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
Dim note as NotesDocument

set uidoc = ws.CurrentDocument
set note = uidoc.Document

set item = note.GetFirstItem( "Body" )
if note.SendTo(0) = "Recipient Name" then
Call item.AppendText( "<Your Text>" )
End if

Call note.Save(True,false)

====

Good Luck
~Hemanth
0
pedro011197Author Commented:
The solution that Gunsen proposed is the one that better fits to my problem.
But, when I save the agent, I get the error

"You do not have execution access privileges for this agent on "server/cert"; agent will not run."

When I create the agent on the mail database "servifax.nsf", i tried three ways:
-with the id of the server "server/cert",
-with the id of the Administrator of the server,
-with the id of the "person" correspondent to the mail database, that is "servifax.id".

The result is always the same error.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

GunsenCommented:
Well, give the server access to the database.
Since this is a mail/paste agent, it is executed ny server trigged by mail-routing.
The id that run's the agent should also have access to execute unrestricted agents configured in the server document in NAB.
0
pedro011197Author Commented:
A last comment:
The solution that proposed Gunsen works well but the agent for some reason does not run "when new mail has arrived".
It does run only launching it manually.
What is the reason?

Pedro.
0
GunsenCommented:
Has the user (owner) who last saved the agent, same mail server ?
If not, try pdating the agent & save it using the servers notes  workstation (thus signing the agent with servers name).
Which version of notes do u run ?
0
pedro011197Author Commented:
The agent is owned by the server, and the server has privileges to run unrestricted and restricted agents, but the agent does not run when new mail arrives!

The server is 4.6 version.
0
GunsenCommented:
Try reebooting the server.
If nothing happens, update notes.ini with,...., and boot again.
AMgr_DisableMailLookup=1
(1 - Do not perform a mail lookups during mail-triggered agents)
0
asdapriceCommented:
Have you check to see if you have rights
in the server doc in agent manager
to "Run unrestricted LotusScript/Java agents:"

If you and the server are not in this list the agent will not run.

PS you the server that is runing the agent must also be you home mail server.




0
GunsenCommented:
asdaprice !
The custom here is to post as a comment, leaving it up to the questioner to accept any comment as an answer.
Anyhow, all u have said has been commented.  Im waiting for pedro to come back with more symptoms/problems....
0
pedro011197Author Commented:
Hi Gunsen,
the agent keeps not running when new mail arrives to the mail database.
The owner of the agent is the server, the Agent Manager is started on the server, and the server have all the rights. Also AMgr_DisableMailLookup=1
in notes.ini and the server has been restarted.
Any other thing to try?

thanks,

Pedro.
0
GunsenCommented:
If the AMgr_DisableMailLookup=1 does not function properly, you have to check that ur PAB holds hierarchic (if used) names of the signer of agent & is on the same server.
Else u can upgrade server to 4.6.4a or 4.6.5, where this is fixed.
0
pedro011197Author Commented:
Hi Gunsen,
the agent keeps not running when new mail arrives to the mail database.
The owner of the agent is the server, the Agent Manager is started on the server, and the server have all the rights. Also AMgr_DisableMailLookup=1
in notes.ini and the server has been restarted.
Any other thing to try?

thanks,

Pedro.
0
GunsenCommented:
..and is the server registered as a hirerarchic name in the PAB ...?
else try saving the agent with a person's id that is on the same server and is registered in PAB with a qualified hierarchic name.

The ACL should also hold all tested names.

Then u should test the agent manager service on ur server - follow link :
http://support.lotus.com/sims2.nsf/802ee480bdd32d0b852566fa005acf8d/3ee96f998accc52c852563e70062d42b?OpenDocument
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pedro011197Author Commented:
Hi Gunsen,
the agent keeps not running when new mail arrives to the mail database.
The owner of the agent is the server, the Agent Manager is started on the server, and the server have all the rights. Also AMgr_DisableMailLookup=1
in notes.ini and the server has been restarted.
Any other thing to try?

thanks,

Pedro.
0
pedro011197Author Commented:
Gunsen, please make a comment or propose an answer so I can give the points to you.

Thanks to everybody.
0
GunsenCommented:
Thanx, pedro.  I hope u did work it out...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.