For the record, the solution that I decided best for me was to simply check the line starting with βFROM:β, Michael suggested. I stop looking for my text as soon as it is found. This has been working fine for me for a while.
Thanks for the answers and ideas, that's all.
Here is my code for reference:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim theLine As String
Dim aBody()
Dim bFound As Boolean
Dim ctr As Long
aBody = Array(Split(Item.Body, vbNewLine))
bFound = False
For ctr = 0 To UBound(aBody(1))
theLine = aBody(1)(ctr)
If InStr(theLine, "From:") > 0 Then
Exit For
End If
If InStr(UCase(theLine), "ATTACH") > 0 Then
bFound = True
End If
Next
If bFound Then
If Item.Attachments.Count < 1 Then
Dim ans As Integer
ans = MsgBox("Do you really want to send this without any attachments?", vbYesNo)
If ans = 7 Then
Cancel = True
Exit Sub
End If
End If
End If
End Sub
Peter source
share