How to get the field "$FILE" in the new memo?

They are a problem with the agent because the agent don’t send files attached in the mail. When I receive the mail they are no file inside the mail …

I would like to get the field $file , how can I do to add this …

This is the code of maillist.nsf . if you can adapt to get $file

.

Sub Initialize

Dim Session As New NotesSession

Dim MailListFile As NotesDatabase

Dim NewMessage As NotesDocument

Dim Subscribers As NotesView

Dim NeedProcessing As NotesView

Dim Subscription As NotesDocument

Dim Processed As NotesItem

Dim FormName As NotesItem



Set MailListFile = Session.CurrentDatabase



 ' Figure out if we need to process any 

Set NeedProcessing = MailListFile.GetView ("($NeedProcessing)")

Set NewMessage = NeedProcessing.GetFirstDocument



  ' Loop through all of the subscriptions sending the message to them

While Not (NewMessage Is Nothing)	

	

 	' If the subject is subscribe, then add the sender to the group

	If (NewMessage.GetItemValue ("Subject")(0) = "Subscribe") Then

		If (NewMessage.GetItemValue ("Processed")(0) = "") Then

			Set Subscribers = MailListFile.GetView ("($Subscriptions)")

			Set Subscription = Subscribers.GetDocumentByKey (NewMessage.From(0), True)    

			

                ' Only register a given user once    

			If (Subscription Is Nothing) Then

                     ' Allocate a new note for the subsciption

				Dim NewSubscription As New NotesDocument (MailListFile)

				

                     ' Allocate all of the new items of the subsciption  

				Dim Failure As New NotesItem (NewSubscription, "Failures", 0)

				Dim Address As New NotesItem (NewSubscription, "Address", NewMessage.From)		

				Set FormName =  New NotesItem (NewSubscription, "Form", "Subscription")	

				Set Processed =  New NotesItem (NewSubscription, "Processed", "1")

				

                     ' Make sure that these fields can be seen in views

				Failure.IsSummary= True

				Address.IsSummary= True		

				FormName.IsSummary= True

				Processed.IsSummary = True

				

                     ' Send the user an ack     

				Call SendMail("Subscribe", "You have been added to the mailing list", NewSubscription.GetItemValue ("Address")(0), MailListFile.Title)

				

                      ' Save the new note and it's new items

				Call NewSubscription.Save (True, False)      

			End If

			

                ' Make sure this document is not processed again

			Set Processed =  New NotesItem (NewMessage, "Processed", "1")

			Processed.IsSummary = True

			

			Call NewMessage.Save (True, False)

		End If

	Else

           ' If the subject is unsubscribe, then remove the sender from the list

		If (NewMessage.GetItemValue ("Subject")(0) = "Unsubscribe") Then

			Set Subscribers = MailListFile.GetView ("($Subscriptions)")

			Set Subscription = Subscribers.GetDocumentByKey (NewMessage.From(0), True)    

			

                ' Send the user an ack     

			Call SendMail ("Subscribe", "You have been removed from the mailing list", NewSubscription.GetItemValue ("Address")(0), MailListFile.Title)

			

                ' Make sure we found a subscription before we try to delete it

			If (Not (Subscription Is Nothing)) Then

				Call Subscription.Remove (True)

			End If

			

                ' Make sure this document is not processed again

			Set Processed =  New NotesItem (NewMessage, "Processed", "1")

			Processed.IsSummary = True

			

			Call NewMessage.Save (True, False)

		Else

			If (NewMessage.GetItemValue ("Processed")(0) = "") Then

                     ' Send the message to the subscribers

				

				Set Subscribers = MailListFile.GetView ("($Subscriptions)")

				Set Subscription = Subscribers.GetFirstDocument

				

                     ' Make sure this document is not processed again

				Set Processed = New NotesItem (NewMessage, "Processed", "1")

				Processed.IsSummary = True

				

				Call NewMessage.Save (True, False)

				

                      ' Loop through all of the subscriptions sending the message to them

				While Not (Subscription Is Nothing)					

					Call SendMail(NewMessage.GetItemValue ("Subject")(0), NewMessage.GetItemValue ("BODY")(0), Subscription.GetItemValue ("Address")(0), MailListFile.Title)

					Set Subscription = Subscribers.GetNextDocument (Subscription)

				Wend

			End If			

		End If

	End If

	

      ' Get the next message that needs to be processed  

	Set NeedProcessing = MailListFile.GetView ("($NeedProcessing)")

	Set NewMessage = NeedProcessing.GetFirstDocument

Wend

End Sub

Sub SendMail (subject As String, body As String, recipients As String, whofrom As String)

 ' Subroutine to create email messages directly 

 'in the mail.box for router to deliver



 'Setup sane logic

On Error Goto HandleError



 'Allocate worker vars.

Dim session As NotesSession 

Dim db As NotesDatabase

Dim Memobody As NotesRichTextItem

Dim object As NotesEmbeddedObject



 'Create the document in MAIL.BOX on current server

Set session = New NotesSession

Set db = session.GetDatabase("","mail.box")

Dim memo As New NotesDocument(db)



 'Convert recipients array into NAMES fields in Memo

Dim recip As New NotesItem(memo,"Recipients",recipients,NAMES)

Dim sendTo As New NotesItem(memo,"SendTo",recipients,NAMES)

Dim blindCopy As New NotesItem(memo,"BlindCopyTo","",NAMES)



 ' Make recip and sendTo Summary Fields. Failure to do so

 ' will prevent them appearing in view columns. If they 

 ' don't appear in a view column ROUTER task will reject them.

 ' This is a very common mistake to forget about this.

recip.IsSummary = True

sendTo.IsSummary = True



 'Put body into richtext field

Set MemoBody = memo.CreateRichTextItem( "Body" ) 

Call MemoBody.AppendText(body) 



 'Set Various memo control fields for Notes Friendliness

memo.Form = "Memo"

memo.From = whofrom

memo.Subject = subject

memo.MailFormat = "T"

memo.DeliveryPriority = "High"

memo.deliveryReport = "O"



Call memo.save(True,False)

Done:

On Error Goto Bail

 'Misc post processing goes here

Exit Sub

HandleError:

 'Aggh something fail put error on browser so it can be spotted

Dim status As String 

status$ = "Error! " & Err() & " at line " & Erl() & ": " & Error()

Messagebox(status$)

Resume Done

Bail:

status$ = "Error " & Err() & " at line " & Erl() & ": " & Error()

Messagebox(status$)

Resume BailOut

BailOut:

End Sub