A couple of months ago, we described on this page a simple programmatic way to disable popup windows. We've heard back from some of you with tweaks and pointers for this code, and we'll be bringing you some of these efforts in an upcoming issue.
This month, we'd like to discuss an even more insidious problem. When you get mail in HTML format, the mail can contain a device called a Web bug. This is a hidden (or not so hidden) field that notifies senders when you read their mail—or even when you view it in a preview pane. This makes it a lot easier to harvest known good addresses for spammers to sell to one another. Sometimes it's from a business that wants to make sure its mailing list is up-to-date, but sometimes it's meant to track you without being seen. This one came from some mail that had nothing to do with the URL in question, and actually popped up a cookie notification on our systems:
<img width=1 height=1 src="https://www.s2u2.com/
email_type.asp?email_id=6808308&email_type=3">
Once companies combine your IP address with your e-mail address, they can start bombarding you with "special offers" based on the Web sites you've visited at any point in your life. The bad news is that Web bugs are easy to set up. Just create an <img> tag that points to an ASP script, then stick it in the mail somewhere. If you have a connection to a SQL Server database with two fields—UserID and HitTime, you could send someone HTML-format e-mail with this tag in it:
<img width=1 height=1 src="https://www.example.com/
trackyou.asp?uid=390321">
Then, trackyou.asp would simply need an embedded snippet:
uname = Request.QueryString("uid")
SQL = "INSERT userhits (UserID, HitTime) VALUES ('" & _
uname & _ "','" & Now() & "')"
Set RSUpd = Conn.Execute(SQL)
Response.ContentType = "image/gif"
Setting the content type to image/gif tells the browser that you're loading a GIF. Even if you don't send any GIF data back, the browser will simply assume it's broken and print a "broken image" icon—but in a not-too-visible 1�1 area.
All is not a hopeless tangle of Web bugs and marketing opt-out lists, however. If you're running Outlook, you can make it warn you in advance when incoming mail has a Web bug. The secret is in the Outlook object model. To capture events in Outlook, you can start by creating a new macro (Tools | Macro). Declare an instance of Outlook.Application with the WithEvents tag:
Dim WithEvents myOlApp As Outlook.Application
Sub Init()
Set myOlApp = CreateObject("Outlook.Application")
End Sub
Now you'll be able to receive all sorts of crazy events in your code! One example is ItemAdd—fired whenever a new item is added to your Inbox (either as new mail or dragged into the folder). The item is passed in as an object. If it's of type MailItem, then you can use code to look at the contents without actually opening it and triggering the Web bug. If Item.HTMLBody isn't empty, it means that the mail is formatted as HTML, and Outlook will display it as such. You can search through the message's HTMLBody for the string "src"; if found, you can pop up a message box to warn the user that there's a potential Web bug lurking in the message:
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
If TypeName(Item) = "MailItem" Then
h = Item.HTMLBody ' empty unless it's HTML mail
If Len(h) > 0 Then ' if it IS HTML mail...
img = InStr(h, "IMG") ' Search for IMG tags
limg = InStr(h,"img") ' Search for lowercase tag
If (img > 0) Or (limg > 0) Then MsgBox ("Message: " & _
Item.Subject & " has an IMG tag!")
End If
End If ' Type is mailitem
End Sub
This is a good start. You can probably see the big problem—there's no delivery mechanism for this macro. This code only runs when you run it manually through Tools | Macros, and it pops up a bunch of messages, one for each Web-bugged message that arrives. Sort of annoying.
We'll be looking at this project some more in the months to come. Alternatives include having the macro loop through an Inbox all at once, or designing a form that checks all HTML messages as you're opening them. All ideas and input about how to improve this program are welcome.
|