Solved

Auto-forwarding agent with reply to correct including attachments

Posted on 2006-07-23
5
2,249 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
Comment Utility
We could change the code of course, but... why don't you use Rules for this purpose?
0
 
LVL 4

Author Comment

by:Blackmoorian
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
:) 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now