Perl : mail2mysql
December 2000
mail2mysql.pl is a script which reads a mailbox file,
parses the messages and inserts them into a MySQL database.
Background
This script was written to send notices via email and have them
displayed on the web. The script monitors an email box for messages,
when a message arrives it gets put into a database. The database
entries are displayed on a webpage using PHP.
Because the final destination was the web, I wanted the email messages to be
displayed as HTML.
Requirements
- mhonarc email to HTML converter.
mhonarc is used to parse multipart messages and to convert the plain text
email to HTML messages.
- MailTools module
This module is used to parses the mailbox into individual messages.
It needs to be downloaded from CPAN.
- DBI - MySQL
Appropiate DBI and MySQL drivers should be installed to insert the
messages into the database.
See script comments for more customization and configuration.
Download Script: mail2mysql_pl.txt
Related Links:
mhonarc.org - An e-mail to HTML converter
CPAN Mail Category
|