Solved

Auto-forwarding agent with reply to correct including attachments

Posted on 2006-07-23
5
2,259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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!

Question has a verified solution.

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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
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.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

688 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