Go Back   The macosxhints Forums > OS X Help Requests > Applications

Thread Tools Rate Thread Display Modes
Old 05-16-2006, 05:37 AM   #1
Major Leaguer
Join Date: Mar 2005
Posts: 322
Connecting to Mail's SQLite database

If I understand correctly, Mail.app uses an SQLite database to store messages. Is it possible to connect to this database using an application other than Mail? I want to write a PHP script to access the mailbox.

markashley is offline   Reply With Quote
Old 05-16-2006, 02:12 PM   #2
All Star
Join Date: Jan 2002
Location: CO, USA
Posts: 908
I don't believe the text of messages is stored in the sqlite DB, but other data (subject, sender, recipient, etc) are. The DB is in the file ~/Library/Mail/Envelope Index, and the sqlite3 command can view it:
$ sqlite3 /Users/blb/Library/Mail/Envelope\ Index 
SQLite version 3.1.3
Enter ".help" for instructions
sqlite> .schema
CREATE TABLE addresses (ROWID INTEGER PRIMARY KEY, address, comment, UNIQUE(address, comment));
sqlite> select count(*) from messages;
I suggest you not do any changes unless you've made a backup and don't currently have Mail running...
blb is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 07:13 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.