mailboxparser
mailboxparser - Parsing Bounced Emails
mailboxparser command of bounceHammer parse bounced emails in a mailbox or a Maildir/,
and finds a reason of email bounce, and classifies a domain part of a recipient into hostgroup (PC, Webmail, Smartphone).
Then the command write parsed data ( Data Structure) into a file as a YAML format.
This command has been installed in INSTALL-DESTINATION/bin directory.
Usage
Basically, the argument of mailboxparser command is the only path of the mailbox or the Maildir
which you want to parse. When the command is called without any option, parsed data will be displayed
in Standard out. The command with --help option show available options in the help message.
# mailboxparser /var/mail/user1 ⏎
Multiple mailboxes in the argument
# mailboxparser /var/mail/user1 /var/mail/user2 /var/mail/root ⏎
A Maildir/ in the argument
# mailboxparser /home/user1/Maildir/cur ⏎
Read bounced email text from STDIN
# cat /var/mail/user3 | mailboxparser ⏎
Show help message
# mailboxparser --help ⏎
Available Options
Options for Parsing
- -g, --greed
- The command parses a bounced email greedy with attempting to find an email address from less common e-mail header.
- -s, --skip
- The command skips a bounced email which reason of email bounce is less important. This option is equals to all of the following options: --skip-norelaying, --skip-mailererror, --skip-hostunknown, --skip-temperror .
- --skip-norelaying
- This option does not include a bounced email which reason of email bounce is "Relaying Denied" in parsed data. The error "Relaying Denied" will be incurred often by mis-configuration of SMTP server.
- --skip-mailererror
- This option does not include a bounced email which reason of email bounce is "Unknown Mailer Error" in parsed data. The error "Unknown Mailer Error" will be incurred often by mis-configuration of SMTP server or mailer programs.
- --skip-hostunknown
- This option does not include a bounced email which reason of email bounce is "Host Unknown" in parsed data. In many cases, the error "Host Unknown" is due to the misspelling in recipient email address.
- --skip-temperror (Beginning with ver.2.2.0)
- This option does not include a bounced email which is temporay error (error code is 4xx).
Options for Logging
- -2, --two-way (Beginning with ver.2.1.0)
-
This option write parsed data both of the temporary log file(YAML) and standard out.
-l, --log option (described later) works the same as this option
about writing a temporary log file. This option is intended to use in /etc/mail/aliases file
like the following.
- Parsed data will be saved in the temporary log file
- Parsed data will be inserted into the database by databasectl command via pipe line
- -l, --log
- This option write parsed data into a temporary log file (YAML format). If this option is omitted, parsed data will be displayed in standard out. The temporary log file will saved in a directory which is defined at etc/bouncehammer.cf . A user who execute this command should have permissions to write the directory.
- -o, --output Directory Name
- This option write parsed data into a temporary log file in a specified directory. A user who execute this command should have permissions to write the specified directory.
- --truncate
- After parsing, this option truncate (file size=0) a original mailbox or an email file in Maildir/. If there are many bounced emails in a mbox like /var/mail/bounce, This option is useful to leave a mailbox file with size 0.
- --remove
- After parsing, this option removes a original mailbox or an email file in Maildir/.
- --backup Directory Name (Beginning with ver.2.2.0)
- After parsing, this option move a original files to a specified directory.
- --save-failed-mesg (Beginning with ver.2.7.0)
- After parsing, this option saves an email which cannot be parsed by mailboxparser. into the directory defined in etc/bouncehammer.cf(directory->spool). The email will be saved as failed.MessageID or MD5 value.eml.
Other Options
- -B, --batch (Beginning with ver.2.3.1)
- Runs as a batch mode. Results of the command will be displayed as a YAML format. It useful to send the results to an administrator with an email.
- -C, --conf /path/to/configuration file
- Use an alternative bounceHammer's configuration file. If this option is omitted, the command will use INSTALL-DESTINATION/etc/bouncehammer.cf .
- -T, --test
- Runs as test mode. This option is equals to the option -C INSTALL-DESTINATION/etc/test-run.cf .
- -F, --fotmat Character
- Display parsed data as a specified format. If this option is omitted, the results are displayed as a ASCII Table. Available format characters are the following: yaml: YAML, json: JSON, asciitable: ASCII Table, and csv: CSV(Beginning with Ver. 2.4.0)
- --silent (Beginning with ver.2.1.0)
- Turn silent mode on. This option makes the command quiet in spite of -v, --verbose option (described later). And when the command is called from a daemon (such as sendmail), the command will exit with status 0 in spite of an error. If an MTA process (e.g. /usr/sbin/sendmail) which is called the command without this --silent option stopped by an error, the command will exit with status 75(EX_TEMPFAIL).
- -v, --verbose
- Turn verbose mode ON.
- --help
- Display help messages of this command.
- --version
- Display the version number of this command.
Screenshots of the running commands
mailboxparser --format a -vvvv Maildir/new
The following screenshot shows that mailboxparser parse bounced emails in the Maildir/new direcotry, and display the results in stadard out as a ASCII Table format.
mailboxparser -vvvv Maildir/new --log --batch
The following screenshot shows that mailboxparser parse bounced emails in the Maildir/new direcotry, and write the results to the temporary log file in /usr/local/bouncehammer/var/spool directory.
No TrackBacks
TrackBack URL: http://bouncehammer.jp/cgi-bin/mt/mt-tb.cgi/105

Leave a comment