• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 757
  • Last Modified:

Agent for autoforwarding mails in lotus notes

There's a requirement of autoforwarding of mails from one notes mailing database to some external mail address when a new mails comes in mailing database.

I have created an agent for this which is forwarding new mails.

Dim db As NotesDatabase
Dim Maildoc As NotesDocument
Set db=session.currentDatabase
Dim doccoll As NotesDocumentCollection
Set doccoll=db.unprocessedDocuments
Dim forwardDoc As NotesDocument
Dim a As Integer
Print "agent started runing"
Print "agent runnning for " doccoll.count " documents"
    For a=1 To doccoll.count
        Set forwardDoc=doccoll.GetNthDocument(a)
        Set Maildoc = New NotesDocument( db )
      Call forwardDoc.CopyAllItems( Maildoc, True )
      Maildoc.Principal = forwardDoc.From(0)
      Maildoc.SendTo ="xyz@gmail.com"
      Maildoc.copyTo=""
      Maildoc.BlindCopyTo=""
      'Call maildoc.Save(True,True)
      Call Maildoc.Send(True)
      Print a
      Next

Exit subs

Agent is trigered on event "when a new mail has arrived"

But agent is only running for one time .
means intaily when database has no mails i have pasted some documents in it.
it works for one time .
After this again i have pasted some document .So the agent should run but its not working?
0
Glactus
Asked:
Glactus
  • 3
  • 3
  • 2
  • +3
1 Solution
 
doninjaCommented:
on the server console you can type "tell amgr sched" and see if agent is registered in agent manager with the appropriate action.
V M  [agent name] [Path to agent]

Also is the agent should provide log of when agent last run against x number of documents.
I believe if the agent is set to after new mail  then it is kicked off by the router process, so after initial run copying documents into the database will not trigger it, it should be mailed to the database so that router tasks detects it.
Possibly somone can confirm/refute that.

Alternative is to use event when documents ceated or modified and create a flag field in documents that are forwarded.
0
 
Sjef BosmanGroupware ConsultantCommented:
Is mail received directly into this mail database, or in a replica?

Check the server's log .nsf database, Miscellaneous section, where the agent might have left you an error message.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cohalexCommented:
If you would like to have a copy of the mail delivered to the mail file as well in addition to having it forwarded, than the best solution is to simply create a mail file rule for "Send copy to" - you probably need an 8 + mail template to have this rule available.

If you would like to forward the mails without having a copy in the mail file, than use the forwarding email address field in the person document / mail-in document.

The agent is not a recommended solution.
0
 
wuesten_fuchsCommented:
Pasting mail documents into a database does NOT trigger "after new mail has arrived" agents. Such agents are ONLY triggered when the router task _delivers_ mail to the database.

If you want your agent to be triggered when you paste mail documents into the database, then you need to specify its trigger as "after documents are created or modified" (but be aware of the few minutes of delay until your agent runs after you pasted documents).
0
 
GlactusAuthor Commented:
The agent started working, I dont know I diid nothing but it started working automatically.
0
 
Sjef BosmanGroupware ConsultantCommented:
Brilliant! Does nothing and it works! There must be many companies that are desperately looking for a magician like you as Administrator...  ;-))
0
 
wuesten_fuchsCommented:
I guess that simply new _real_ mails came in (delivered by the router) and triggered the agent.
As I wrote above, the agent could not have been triggered since he had set "new mail" as the trigger but tried to test with _pasting_ mail documents into it.
0
 
Sjef BosmanGroupware ConsultantCommented:
Very plausible explanation.
0
 
GlactusAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Glactus's comment http:/Q_26964453.html#35963892

for the following reason:

The agent started working, I dont know I diid nothing but it started working automatically.
0
 
wuesten_fuchsCommented:
See my explanation in Comment ID 35964620.
0

Featured Post

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.

  • 3
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now