Solved

Auto-forwarding agent with reply to correct including attachments

Posted on 2006-07-23
5
2,252 Views
Last Modified: 2013-12-18
We are running Notes Domino 6.5.1 on Windows 2000 Server.

I need to be able to forward email to another address for some executives for their mobile devices. Until recently the code we were using was working fine. Unfortunately with technology getting more advanced the executives can now open attachments and would like us to include attachments as well.

The following code has been great except for it does not include attachments:

Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim col As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim maildoc As NotesDocument
      
      Set db = s.currentdatabase
      Set col = db.unprocesseddocuments
      Set doc = col.getfirstdocument
      While Not (doc Is Nothing)
            Set maildoc = db.createdocument
            maildoc.From = doc.From
            maildoc.Principal = doc.From                  
            maildoc.ReplyTo = doc.From
            maildoc.SendTo = "<User's E-Mail Account>"
            maildoc.CopyTo = "<User's E-Mail Secondary Account (if applicable)>"
            maildoc.Subject = doc.Subject
            maildoc.Body = doc.Body
            maildoc.Form = "Memo"
            maildoc.Send (False)
            Call s.UpdateProcessedDoc( doc )
            Set doc = col.getnextdocument( doc )
      Wend
End Sub

Can anyone tell me how to include attachments with this code?
0
Comment
Question by:Blackmoorian
  • 3
  • 2
5 Comments
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 500 total points
ID: 17166841
We could change the code of course, but... why don't you use Rules for this purpose?
0
 
LVL 4

Author Comment

by:Blackmoorian
ID: 17173101
We were using agents because the rules seems to stop working all of a sudden every so often. Only after a reboot do people's rules start working again. So if you have any suggestions for keeping them operational all the time, we can use rules otherwise we need to stick with agents.
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 17173705
Instead of
          maildoc.Body = doc.Body
use
          Call doc.GetFirstItem("Body").CopyToDocument(maildoc, "")

Why rules just quit on you I don't know. I'll try to find some page on that, but I've never heard of the problem.
0
 
LVL 4

Author Comment

by:Blackmoorian
ID: 17190022
That gave me the point in the right direction:

Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim col As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim maildoc As NotesDocument
      Dim rtItem As NotesRichTextItem
      Dim itemA As NotesItem
      
      Set db = s.currentdatabase
      Set col = db.unprocesseddocuments
      Set doc = col.getfirstdocument
      While Not (doc Is Nothing)
            Set maildoc = db.createdocument
            maildoc.From = doc.From
            maildoc.Principal = doc.From                  
            maildoc.ReplyTo = doc.From
                                maildoc.SendTo = "<User's E-Mail Account>"
                                maildoc.CopyTo = "<User's E-Mail Secondary Account (if applicable)>"
            maildoc.Subject = doc.Subject
            Set itemA = doc.GetFirstItem( "Body" )
            Call itemA.CopyItemToDocument(maildoc, "Body")
            maildoc.Form = "Memo"
            maildoc.Send (False)
            Call s.UpdateProcessedDoc( doc )
            Set doc = col.getnextdocument( doc )
      Wend
End Sub
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17190317
:) Thanks.

My combined call is also permitted, so you don't really need the itemA variable... The second parameter of CopyItemToDocument (oh, heck, I see, I forgot the word Item in that call :$ ) may be the empty string.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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