Solved

Auto-forwarding agent with reply to correct including attachments

Posted on 2006-07-23
5
2,255 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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