Parsing hmail log file for all 4xx and 5xx error codes.

This section contains scripts that hMailServer has contributed with. hMailServer 4 is needed to use these.
Post Reply
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Parsing hmail log file for all 4xx and 5xx error codes.

Post by ^DooM^ » 2007-03-07 23:09

Hi All,

I have a hmail log parser for you to use if you are concerned with removing dead email addresses from your user base.

This was created because people like yahoo and hotmail require you to stop sending email on a 554/550 (Actually they would like you to stop sending email on any 5xx code) else risk being taken off their whitelist, which you worked so hard to get onto in the first place, or even worse put on their blacklists.

What this parser does is scan hmailservers log files and outputs a log file like so (removed usernames).

Code: Select all

First row is the connection ID in the log file
Second row is the email address
Third row is the error code returned

This parser only pumps out 4xx and 5xx codes with email addresses.

Sometimes when a server you are connecting to just drops the connection the parser is unable to gain an email address for this and the row in the log will look like so:

Code: Select all

These are left in the log on purpose so you can easily lookup what happened from the connection ID in hmails log (Nine times out of ten the server just drops the connection with a 450 (or similar) after the initial HELO command)

Note: You need .Net2.0 Framework installed on your machine to use this parser.

Once extracted and ran, add hmail log files to the parser. (Can span multiple log files)

Note: The log files MUST be in chronological order (Oldest first) when spanning multiple log files.

Once your log files are added to the parser click on process.
Two log files will be produced and saved in the same directory the parser runs from.

ParseResults.txt which will contain the above log formatted code
ParseFailure.txt which contains the connection ID and email address if one existed.

The failure log file basically contains anything that wasn't parsed correctly due to mail servers not behaving properly either by dropping the connection and not giving hmail any warning or are just generally broken.
This log format that has been produced can be easily parsed in php or whatever language you are proficient in to help remove or disable dead email address from your database.
Just remember that mailservers are different and the error codes they return as I found out mean different things. For instance yahoo does not use 550 to denote a dead account, they use 554 but not only that yahoo also use 554 to show a full mailbox as well.

I hope it helps some of you out and also helps to cut down the wasted bandwidth used sending out mass newsletters etc to dead email addresses.

Download v1.0.0

This parser has been tested on 4.3 Build 248 log files. If the log format ever changes this parser will no longer work.
Cheers! :wink:
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

Post Reply