MailSteward Pro

MailSteward Pro™

Contents:
Links:
Export a Tab Or Comma Delimited Text File, an Mbox File, or an SQL File:

Any list of archived or retrieved email can be exported to a tab or comma delimited text file, or to an "mbox" format file that can then be imported into most email clients, or to an SQL file that can be imported into a MySQL database. Just click on the Export drop-down button and select the desired export format. A tab or comma delimited text file can then be imported into FileMaker or other database and spreadsheet applications. An mbox file can then be imported back into OS X Mail or Microsoft Entourage or other email clients, or MailSteward Pro itself. An SQL file can be imported into MySQL. If the tab or comma delimited text file option is chosen, attachments and tags are not exported. Only the plain text portion of the email is exported. If the SQL option is chosen, then everything will be exported, including any attachments and tags and copies of the email raw source. In the case of the mbox format, everything will be exported except for tags. The standard mbox email format does not include the concept of tags.



There are a couple of things to be aware of when exporting an SQL file. In order to import email containing large attachments into MySQL, the MySQL maximum allowed packet size needs to be set large enough to accommodate the attachment blobs. This can be done by adding these lines to the /etc/my.cnf file:

[mysqld]
max_allowed_packet=200M

You can set this size as large as you like. MySQL will only allocate the extra memory when it is needed. The other thing to be aware of is that binary attachments are stored in the original binary format in MailSteward Pro. The SQL generated by MailSteward Pro will also cause the binary attachments to be stored in MySQL as binary blobs. The name chosen for the exported SQL file will be used as the database name.

Here are the SQL statements used to create the MySQL database and the email, the attachments, the origemail, and the tags tables:

CREATE DATABASE IF NOT EXISTS [databasename];
USE [databasename];

CREATE TABLE IF NOT EXISTS email (id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,from_fld VARCHAR(256) NOT NULL,to_fld VARCHAR(256) NOT NULL,subj_fld LONGBLOB NOT NULL,date_fld datetime NOT NULL,mailbox VARCHAR(127) NOT NULL,mailto VARCHAR(127) NOT NULL,body_fld LONGBLOB NOT NULL,numAttach INTEGER NOT NULL DEFAULT 0,attachNames MEDIUMTEXT NOT NULL,attachText MEDIUMTEXT NOT NULL,headings MEDIUMTEXT NOT NULL,INDEX dateIndex (date_fld));

CREATE TABLE IF NOT EXISTS attachments (id INT NOT NULL,type_fld VARCHAR(127) NOT NULL,filename_fld VARCHAR(127) NOT NULL,encode_fld INT default 0,attach_fld LONGBLOB NOT NULL,INDEX idIndex (id));

CREATE TABLE IF NOT EXISTS origemail (id INTEGER PRIMARY KEY,orig_fld LONGBLOB NOT NULL);

CREATE TABLE IF NOT EXISTS tags (id INTEGER PRIMARY KEY,cat_fld VARCHAR(127) NOT NULL,key_fld VARCHAR(127) NOT NULL,priority_fld INT DEFAULT 0,notes_fld MEDIUMTEXT NOT NULL);


TM & Copyright © 2004-2008 pubblog.com. All rights reserved.
MySQL is Copyright © 1995-2008 MySQL AB. All rights reserved.
MailTags is Copyright © Scott Morrison.