[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Capturing Email on smtp & pop3 ports

I need to  capture all email to and from a computer, is there an easy way to do this, I was thinking of port capturing? I see that some antivirus programs capture the mail ...
0
julianpointer
Asked:
julianpointer
1 Solution
 
TheRealLokiSenior DeveloperCommented:
If you want to "intercept" the email before it reaches the computer, and before it is sent, then 1 way is to to change the settings in the email clients. You can get your software to do this automacially on setup/run

This is how earlier antivirus software did it. Your software changes the outlook/outlook express/other client, settings to point to localhost (same computer) on different ports.

e.g. change
pop.someserver.com           port 110
smtp.someserver.com         port 25
to
localhost                         port 2110 (your software listening to this port)
localhost                         port 2025 (your software listening to this port)

There are several ways to implement this
a)
when changing the account settings in the email client, use a different local port for each account (e.g. 2110 - 2210 range)
That way you know that if the email client talks to localhost: 2110 it is the "first pop account" and really wants to talk to ":someserver.com:110"
and if the email client talks to localhost: 2111 it is the "second pop account" and really wants to talk to "adifferentserver:110"

b) if you just want to check all incoming (pop3) mail, you only need to change the email clients settings
from:
    host: someserver.com
    port: 110
    username: bob
to:
    host: localhost
    port: 2110
    username: someserver.com:bob

when your software receives the connect form the email client on port 2110 it sends back a welcome message, and then waits for the email client to send the "USER" command
when it gets the "USER" command, it strips out the "real server name" (someserver.com) and the "username" (bob)
It then makes the real connection to "someserver.com" and sends the "USER bob" command
from then on, it just relays data both ways. When it does a "RETR" command (DL email), it will save it locally and check for viruses, before relaying it to the email client

c)
These days, you can do a better hook into the POP3: and  SMTP:  protocols in windows, but I'm not sure how to do that

I don't have any more info on this for you, but hopefully it's enough to get you started.


If you want to see the email data, but not intercept/interfere with it, then you will need a packet sniffer.
You can use Etherel for this, it comes with libraries that can be used by delphi
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now