Proposal for "Mail_CheckUser"

» Metadata » Status
  • Status: Proposed
» Description
The Mail_CheckUser is check email addresses for validity with SMTP commands.

qmail,other non-monolithic mail servers and Some spam mail filters often report that a user exists even if it is not so.
But network checks of this package is useful for the decrease of the bounced email by the misspelling, server errors etc.

You should add SPF record to your domain's DNS configuration.
If you don't, response of 5xx might be returned also to the existing address.
(e.g hotmail and other)
In that case, Your server can't send email to those servers.

1) This will check email address by regex with The Mail_RFC822 package
2) Next, This will send SMTP commands with The Net_SMTP package

HELO fqdn # constructor param
Mail From: # constructor param

3) Check response code from SMTP server and return true or flase.
Default, if response code is 250 or 251, return true.
Response code for true can customize.


$chk = new CheckUser($fqdn, $sender);
if ( $chk->checkUser($_POST['email']) ) {
print "OK";
print "Invalid email address";

If you think almost every other situation indicates 'possible' success.
You can set response code to return true.

It will return true when SMTP SEVER connection failed and other temporary error.

$chk = new CheckUser($fqdn, $sender);
if ( $chk->checkUser($_POST['email']) ) {
print "OK";
print "Invalid email address";

getResponse() method will returun SMTP response information as array.

array(2) {
string(100) "5.1.1 <>: Recipient address rejected: User unknown in local recipient table"
» Dependencies » Links
  • PEAR
  • Mail
  • Net_SMTP
» Timeline » Changelog
  • First Draft: 2009-07-15
  • Proposal: 2009-07-17
  • Call for Votes: 1970-01-01
  • Voting Extended: 1970-01-01
  • Takayuki Miyauchi
    [2009-07-17 21:14 UTC]

    1) change to PHP5.
    2) change $fqdn and $sender to constructor params.
  • Takayuki Miyauchi
    [2009-07-20 18:01 UTC]

    version 0.1.1 alpha

    --Add methods--
    - setTimeout()
    Set timeout to SMTP server.
    - getError()
    Return PEAR_Error object.
    It is re-casted from Net_SMTP package and other.
    - setOKCodes()
    If you set response codes(e.g. 4xx) to method parameters.
    This method return true if get the response codes.

    --bug fix--
    1) Net_SMTP package return true or PEAR_Error.
    But I was checked only true or false.
    2) If in a CLI, can not get $_SERVER args.
    Change to get env values from $_SERVER or $_ENV;

    This English understand??
    Sorry, If I make mistakes in my English!!