?
Solved

Auto-forwarding agent with reply to correct including attachments

Posted on 2006-07-23
5
Medium Priority
?
2,263 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 2000 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

862 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