pilif.ch - a cuwps

[home]
stuff
some worldwide unique stuff
  • Daily Strips
  • PersistentHandler
  • Denis' Birthday
  • DVD-Region (1)
  • DVD-Region (2)
  • Defeating Miguel
  • Neuronal Interface ;-)
  • Swiss ADSL Check
  • Autodestructing Email
  • Fun with bounces

  • Introduction
  • Theory
  • Solution
  • The MTA
  • Code
  • Conclusion
  • backstage
    backstage-reports of some of my paid projects
  • bookexchange.ch
  • info
    valuable information for my visitors
  • RasInTask
  •  
    introduction
    About two months ago, when I was writing this big web-application, I came into the situation where the application had to send weekly statistic reports to the registered users.

    Because I wanted to safe bandwith and because I thought that the statistics are really interesting for the users, I wanted to achieve the following two goals:

    • The application should not more than two times try to send an email to an invalid Email-Adress.
    • The users with invalid adresses should be warned in their preferences-screen to allow them to either turn of the delivery or to correct their addresses.
    As you may know, it is nearly impossible to validate every possible email-address on registration: Also if you check the username-part at the MX-Host of the domain, you never can be sure that the address really exists. And: I did not want to slow down the users registration process by checking her address (and think about it: what if the MX of the user was not available when she tried to register? Should I block her?).

    This led me to the idea not to detect false adresses until the mail is really sent to the user.

    This article will show you, how to do this. First, I will explain the theoretical principles, then I will go into the details and explain my own implementation. If you don't like PHP or Exim, you will have to stick with the theoretical explanations, but they should be accurate enough to do this task in your own environment.

    requirements
    To follow the first part of this article, you need no more than some basic understandings about Internet Email. I'll try to explain the important things suitable for everyone that is writing web-applications.

    If you want to follow my practical workshop, you will need the following:

    • root-Access on a Unix-Server
    • the MTA Exim
    • the scripting-language PHP
    If you don't have these tools and you don't want to install them, you should at least be able to understand PHP-Code and the Exim Configuration-File. You can replace both with tools of your choice as long as they allow the following:
    • the programming-language must allow you to read command-line parameters and to read from STDIN. Actually I don't know even one language (besides BASIC) that does not have these features
    • your MTA should be able to selectively pass received messages to an external application
    Before you begin, there is one last requirement: Your Server must be a registered MX for some domain and must be configured (and should possibly be tested) to receive Email from the Internet (or the intranet if you want to do everything a bit down-stripped).

    Please call your DNS-Admin to get the MX-Record, but consider thinking about what you are doing with this.


    © 2003 by pilif. cuwps stands for completely useless webpage and is a non-registered non-trademark by pilif - Last Modification: 04/03/01 at 02:07:00