?
Solved

including string in message body

Posted on 2000-02-07
17
Medium Priority
?
222 Views
Last Modified: 2013-12-18
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.
0
Comment
Question by:pedro011197
17 Comments
 
LVL 3

Expert Comment

by:Gunsen
ID: 2496274
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
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 2496921
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
 

Author Comment

by:pedro011197
ID: 2508525
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:Gunsen
ID: 2510661
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
 

Author Comment

by:pedro011197
ID: 2514098
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
 
LVL 3

Expert Comment

by:Gunsen
ID: 2518063
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
 

Author Comment

by:pedro011197
ID: 2518369
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
 
LVL 3

Expert Comment

by:Gunsen
ID: 2518642
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
 

Expert Comment

by:asdaprice
ID: 2519058
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
 
LVL 3

Expert Comment

by:Gunsen
ID: 2530315
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
 

Author Comment

by:pedro011197
ID: 2530341
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
 
LVL 3

Expert Comment

by:Gunsen
ID: 2530422
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
 

Author Comment

by:pedro011197
ID: 2530428
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
 
LVL 3

Accepted Solution

by:
Gunsen earned 1200 total points
ID: 2530507
..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
 

Author Comment

by:pedro011197
ID: 2530594
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
 

Author Comment

by:pedro011197
ID: 2551214
Gunsen, please make a comment or propose an answer so I can give the points to you.

Thanks to everybody.
0
 
LVL 3

Expert Comment

by:Gunsen
ID: 2553609
Thanx, pedro.  I hope u did work it out...
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

592 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question