View Single Post
  #2  
Old July 1st 06, 03:17 PM posted to microsoft.public.outlook.program_vba
BlaM
external usenet poster
 
Posts: 1
Default Automatically click on links in incoming mails

Hi again,

found an answer myself:

Private Declare Function URLDownloadToFile Lib "urlmon.dll" Alias
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String,
ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As
Long) As Long

Public Function DownloadFile(URL As String, LocalFileName As String) As
Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFileName, 0, 0)
DownloadFile = (lngRetVal = 0)
End Function

Sub ClickX3ScriptsLink(MyMail As MailItem)
Dim x
x = InStr(MyMail.Body,
"http://www.x3scripts.com/tgp/confirm.x3ml?")
If x 0 Then
URL$ = Mid(MyMail.Body, x)
x = InStr(URL$, Chr$(13))
URL$ = Trim(Left(URL$, x - 1))
DownloadFile URL$, Environ("TEMP") & "\x3.tmp"
MyMail.Body = MyMail.Body & Chr(13) & Chr(13) & "done"
End If
End Sub

And then call "ClickX3ScriptsLink" by a rule.

Ads