Until R4.6 we didn't have the ability to automatically forward mail. For example, you are leaving to Canada and...
you want to check your mail and you cannot RAS in, wouldn't it be nice to tell Notes to forward your mail to your Hotmail until you come back.
This agent forwards messages to the address you provide (along with attachments). The agent should be set to "run when new mail arrives". To overcome the problem of running the agent the agent gets the last five documents from your inbox and checks for a flag called "MYFWD", it forwards only if it is "null". After forwarding it marks the flag so that the next time it does not forward the previously sent mail.
(1)If you are creating this agent, you should have rights to run agents on the server.
(2)The subject shows the first 12 letters of the person who has sent you the mail and then the subject. So, when you receive the forwarded mail, it will be from you and the subject would be:
"From : yourfriend Sub: subject he sent you"
<<<<<<< CODE BEGIN >>>>>>
On Error Resume Next
Dim session As New notessession
Dim maildb As notesdatabase
Set maildb = session.currentdatabase
Dim inbox As notesview
Set inbox = maildb.getview("($Inbox)")'get inbox
Call inbox.refresh 'refresh inbox to get newly
'arrived mails after this new mail
Dim newmail As notesdocument
Set newmail = inbox.getlastdocument' get the last document
Dim flag As Integer
flag = 0
For i = 1 To 5 ' check last five documents
If Not(newmail Is Nothing) Then
If newmail.myfwd(0) = "" Then ' if it has not been forwarded
Set doc = New notesdocument(maildb)
doc.form = "Memo"
doc.SendTo = "email@example.com" 'this should be changed to your e-mail
doc.Subject = "From : " & Left _
(newmail.from(0),12) & "Sub:" & _
Forall item In newmail.Items 'check for attachments, if there - copy to new mail
If (item.name = "$FILE") then
Dim ritem As NotesRichTextItem
Set ritem = New NotesRichTextItem _
Dim rtext As String
Dim oritem As NotesRichTextItem
Set oritem = newmail.GetFirstItem("body")
Call ritem.AppendRTItem( oritem )
rtext = oritem.getformattedText(False, 0)
Call ritem.AppendText( rtext )
flag = 1
If flag <> 1 Then
doc.body = newmail.body 'if no attachment then just copy the text
flag = 0
Call doc.send(False)'forward/send the mail
newmail.myfwd = "yes" 'flag the forwarded mail
Call newmail.save(False,True) ' save after flag
Set newmail = inbox.getprevdocument(newmail)
<<<<<<<CODE END >>>>>>>>