Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Bulk replace entries from Mail.app Previous Recipients using sqlite3 ?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Bulk replace entries from Mail.app Previous Recipients using sqlite3 ?
Authored by: smilec on May 23, '11 10:50:15PM

Great hint, I've tried similar things with the other (Addressbook etc) sqlite databases. Does anyone know how to *replace* domain names? My company changed domain from olddomain.org to newdomain.org and I want to do a sed-like substitution of olddomain with newdomain in the SQL query. Possible?



[ Reply to This | # ]
Bulk replace entries from Mail.app Previous Recipients using sqlite3 ?
Authored by: da2357 on May 24, '11 06:27:01AM
Yes, it's possible to just change the domain name in the email address. I'd suggest first copying the MailRecents-v4.abcdmr file to your Desktop and trying it there before doing it on the live copy.

[bash]$ cp "~/Library/Application Support/AddressBook/MailRecents-v4.abcdmr" ~/Desktop/MailRecents-v4.abcdmr
[bash]$ sqlite3 "~/Desktop/MailRecents-v4.abcdmr"
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select ZFIRSTNAME,ZLASTNAME,ZEMAIL from ZABCDMAILRECENT;
John|Smith|johnsmith@somewhere.com
Mary|Jones|maryjones@yahoo.com
David|Collins|davidcollins@somewhere.com
Frank|Tarbox|franktarbox@gmail.com
sqlite> update ZABCDMAILRECENT
...> set ZEMAIL = replace(ZEMAIL,'somewhere.com','newdomain.com')
...> ;
sqlite> select ZFIRSTNAME,ZLASTNAME,ZEMAIL from ZABCDMAILRECENT;
John|Smith|johnsmith@newdomain.com
Mary|Jones|maryjones@yahoo.com
David|Collins|davidcollins@newdomain.com
Frank|Tarbox|franktarbox@gmail.com
sqlite> .quit

If the results are as you expect/want, then perform it on your live 'MailRecents-v4.abcdmr' file.


[ Reply to This | # ]
Bulk replace entries from Mail.app Previous Recipients using sqlite3 ?
Authored by: westont on May 24, '11 08:27:39AM

Great hint ! Have just successfully updated a domain name in my previous recipients list. As always work on a copy though. :-)



[ Reply to This | # ]