Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LotusScript run "Before New Mail..." breaks HTML mail

Status
Not open for further replies.

paulhung

Technical User
Feb 2, 2001
37
US
Hi,

I've been trying to run a script that strips certain attachments before they arrive in your mail. I set the script to run "Before New Mail Arrives" in the template, and in one line of code, have a forall statement:

Forall obj In doc.Items
End Forall

Where doc is "session.DocumentContext". If I comment out the Forall, HTML mail comes in just fine. If I don't, the mail comes in screwed up.

Can anyone help?
 
Here's my code.. still can't see why it's breaking html mail:

Sub Initialize

extensions("vbs") = "VBS attachments"
filenames("mybabypic.exe") = "VB Worm"
filenames("nakedwife.exe") = "VB Worm"

Dim session As New NotesSession
Set doc = session.DocumentContext

Dim emphasize As NotesRichTextStyle
Set emphasize = session.CreateRichTextStyle
emphasize.Bold = True
emphasize.NotesColor = COLOR_RED

Dim FileExtension As String
Dim LogEntries As String
Checker = False

Forall obj In doc.Items
If (obj.Type = ATTACHMENT) Then
Set attach = doc.GetAttachment(obj.Values(0))
filename = Lcase(attach.Source)
FileExtension = Right$(filename, Len(filename)-Instr(1,filename,"."))
Do Until (Instr(1,FileExtension,".")=0)
FileExtension = Right$(FileExtension, Len(FileExtension)-Instr(1,FileExtension,"."))
Loop
If (Iselement(extensions(FileExtension)) = True) Or (Iselement(filenames(Lcase(filename)))) Then
Checker = True
Call attach.ExtractFile( Trim(filelocation) & Trim(filename) & Trim(doc.UniversalID))
Call attach.Remove
End If
End If
End Forall
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top