How can I intercept local SMTP attempts?

2

I'm doing some development work and need an app that will intercept any local SMTP attempts.

By intercept I mean that with zero configuration this application will receive mail on the local computer sent to any email address. So if I'm working on a PHP application and I use the mail() function I can send to any email address I want and this application will receive it like a typical mail client. foo@bar.com, baz@bar.com would all be received as mail by this application.

I know I've seen one but for the life of me I cannot remember what it was called.

Caley Woods

Posted 2012-10-15T00:30:56.823

Reputation: 121

1What do you mean by "intercept"? Do you want to see the SMTP traffic, or do you want to redirect/block it? – sleske – 2012-10-15T07:09:43.810

@sleske By intercept I mean that with zero configuration this application will receive mail on the local computer sent to any email address. So if I'm working on a PHP application and I use the mail() function I can send to any email address I want and this application will receive it like a typical mail client. foo@bar.com, baz@bar.com would all be received as mail by this application. – Caley Woods – 2012-10-15T19:58:19.620

Thanks for the clarification. Please put clarifications into the question (you can edit it), rather than in a comment, so everyone will see it. Fo now, I have edited the question for you. – sleske – 2012-10-16T07:44:01.323

Answers

1

WireShark will allow you to monitor all of the network traffic, and you can filter it by the required port to see only the SMTP traffic (emails).

Michael

Posted 2012-10-15T00:30:56.823

Reputation: 423

The application I've seen is an email application that runs a local SMTP server and intercepts all emails sent from the computer while the application is active. It looks similar to outlook express. – Caley Woods – 2012-10-15T19:59:17.517

0

In order for your application (any application, for that matter) to send mail, the application will need access to a mail server. That mail server can either be running locally, or on a different system (such as your ISP's mail server).

The PHP implementation, as far as I can tell, can either directly invoke a local mail transfer agent (MTA), such as sendmail, or contact a (local or remote) mail server via SMTP.

So the easiest option would probably be to install a local mail server (for how to do this, see e.g. Set up local SMTP and POP3 for testing mail send and receive loop ). Then configure the local mail server to never send out any mail, but just queue everything it gets. Finally, configure PHP to use this mail server.

The relevant PHP config settings for email sending are SMTP, sendmail_path etc..

sleske

Posted 2012-10-15T00:30:56.823

Reputation: 19 887