I have an agent that’s scheduled to run “Before New Mail” Arrives. The agent runs at the router level and when it does it always converts each message from MIME to CD format now. Because of this, embedded images are being lost during the conversion!
Anything I can change in my code or configuration to avoid this?
Thanks
CODE:
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim attach As NotesEmbeddedObject
Dim filename As String
Dim extensions List As String, filenames List As String
Dim body As Variant
Dim Checker As Variant
'This is the list of extensions we are checking for
extensions("vbs") = "VBS attachments"
extensions("vbe") = "VBE attachments"
extensions("pif") = "Program Interface Files"
extensions("scr") = "Screen Saver Files"
extensions("exe") = "Executables"
extensions("avi") = "Windows Animaiton Files"
extensions("com") = "Command Files"
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Dim emphasize As NotesRichTextStyle
Set emphasize = session.CreateRichTextStyle
emphasize.Italic = True
emphasize.NotesColor = COLOR_RED
Dim FileExtension As String
Checker = False
Forall o In doc.Items
If (o.Type = ATTACHMENT) Then
Set attach = doc.GetAttachment(o.Values(0))
'Read the file name in lower case
filename = Lcase(attach.Source)
'Determine the final file extension
FileExtension = Right$(filename, Len(filename)-Instr(1,filename,"."))
Do Until (Instr(1,FileExtension,".")=0)
FileExtension = Right$(FileExtension, Len(FileExtension)-Instr(1,FileExtension,"."))
Loop
'Does attachment fit the stripping requirement
If (Iselement(extensions(FileExtension)) = True) Then
Checker = True
'Strip Attachment
Call attach.Remove
'Append message
Set body = doc.GetFirstItem("Body")
Call body.AddNewLine(1)
Call body.AppendStyle(emphasize)
Call body.AppendText("The following file has been stripped out of this email by a virus checking procedure: " & filename)
End If
End If
End Forall
If checker Then
'Append final message to email
Call body.AddNewLine(1)
Call body.AppendText("For assistance, please call ITHelp.")
Call doc.Save(True, False)
End If