Can an agent extract email attachments from a user's mailbox, and move them to an IFS folder on another iSeries (AS400) box without notes cline running?
We have a generic email account that receives email attachments, but there are no Notes Clients that will be watching it, so this agent would have to react when new mail is received, and extract the attachment and drop it in an IFS share.
You are touching one of my challenges on my to-do list.. I'll also be very grateful to see actual code. :-)
I'll look forward andhope youwill publish the actual code.
Thanks in advance.
OK You will have this code.
Do you know LotusScript ? If i give you my code as is, do you will know how to adapt it (delete what you don't need, change variables, and so on) or you prefer i give you the source a bit rewrited (with comment) ?
In the second case, you have to wait a couple of days cause i'm very busy now...
And sorry for my poor english !
I can get by with the raw code.
I knwo VB, and have been working the LotusScrit for a while.
I can read the uncommented code and get what i need from it.
INITIALIZE
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim viewInbox As NotesView
Dim tabItem As Variant, tabTemp As Variant
Dim sPathFichierExport As String
Dim sPlateForme As String
Set db = s.CurrentDatabase
Set viewInBox = db.GetView( "($InBox)" )
sPlateForme = s.Platform
If splateForme <> "Windows/32" Then
sPathFichierExport = "/MY_IFS_SHAREFOLDER_NAME/"
Else
sPathFichierExport = "\MY_ISERIES_NAMEMY_IFS_SHAREFOLDER_NAME"
End If
Set doc = viewInBox.GetFirstDocument
Do While Not doc Is Nothing
tabItem = doc.Items
Forall ele In tabItem
If ele.Type = RICHTEXT Then
tabTemp = ele.EmbeddedObjects
If Not Isempty(tabTemp) Then
Forall embobj In tabTemp
If embobj.Type = EMBED_ATTACHMENT Then
Call embObj.ExtractFile ( sPathFichierExport + embobj.Name )
' If file exists on the disk, then the attachment is removed !
If yaFichier( sPathFichierExport + embobj.Name ) = 1Then
Call embObj.Remove
Call doc.Save( True, False)
End If
End If
End Forall
End If
End If
End Forall
Set doc = viewInBox.GetNextDocument( doc )
Loop
Quit:
Exit Sub
ErrorHandler:
Print "Erreur ligne " & Erl & " type " & Err & " - " & Error
Goto Quit
Function YaFichier( strFichier As String ) As Integer
If Dir( strFichier , 0 ) = "" Then
YaFichier = 0
Else
YaFichier = 1
End If
End Function
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 7  Replies