-
Notifications
You must be signed in to change notification settings - Fork 97
Mac OSX
Ensure Ruby and RubyGems are upgraded. And that you have a recent ncurses installed (see below), make sure your ruby version is supported by sup (>= 2.0) (currently Ruby versions other than 2.1.2 have problems).
Then install the sup gem:
$ gem install sup
Set up e.g. homebrew using their installation instructions and use it to install ncurses:
$ brew tap homebrew/dupes
$ brew install ncurses
$ brew doctor
# To set up your system to use this version of ncurses in place of the system one
$ brew link ncurses # might require a --force
you should now be set for installing ncursesw-sup.
A useful tutorial for setting up homebrew with rvm and everything can be found at: http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
- Make sure you have no other ncurses gems installed (#69)
- Make sure that you run Ruby 1.9.3 or 2.1.2 (#191)
Homebrew or MacPorts are package managers and software distribution systems. You can use MacPorts or Homebrew to install one of the null mailers (ssmtp, msmtp) discussed in this wiki.
Or setup your postfix similar to this.
Install msmtp with brew install msmtp
and create the .msmtprc
file in your $HOME. Here is a basic msmtp configuration:
account gmail
host smtp.gmail.com
port 587
protocol smtp
auth on
from your.address@gmail.com
user your.address@gmail.com
To get SSL certificates set up, add the following lines to your .msmtprc
:
tls on
tls_trust_file /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
If you want to use OfflineIMAP (also availble in homebrew) you might need to use an updated version of python.
If you want to use mbsync/isync (available on Homebrew), install it with brew install isync
and create the appropriate configuration file .mbsyncrc
in your $HOME:
IMAPAccount 'your_mail_provider' # or whatever you wanna name your account
Host imap.mail.com
User your_address@mail.com
Pass your_password
UseIMAPS yes
IMAPStore 'your_mail_provider'_remote
Account 'your_mail_provider' # or whatever you named it in the first line
MaildirStore 'your_mail_provider'_local
Path $HOME/Mail # path where you wanna store your mails locally
Inbox $HOME/Mail/Inbox # check in your $HOME/Mail how your inbox is named, it can vary depending on your email provider
Channel 'your_email_provider' # or whatever you named your account
Master :'your_mail_provider'_remote:
Slave :'your_mail_provider'_local:
Patterns * # wildcard to synchronise our entire mailbox
Create Slave # this will create the appropriate folders locally
Syncstate * # to store the sync state of each folders in each folder separately
Now you can download your mails locally with mbsync 'name_of_Channel'
.
run sup -l and make sure your version of sup supports the
extra-contact-addresses hook. This is only tested against 10.6
(Snow Lepoard) copy and paste this into your
~/.sup/hooks/extra-contact-addresses.rb
file:
contacts=[]
`sqlite3 -separator ':' ~/Library/Application\\ Support/AddressBook/AddressBook-v22.abcddb "select e.ZADDRESSNORMALIZED,p.ZFIRSTNAME,p.ZLASTNAME,p.ZORGANIZATION from ZABCDRECORD as p,ZABCDEMAILADDRESS as e WHERE e.ZOWNER = p.Z_PK;" | awk -F":" '{print $2" "$3" "$4 , "<"$1">"}'`.each { |c|
contacts.push(c)
}
contacts
That is a CRAZY long line, and in case things go badly, I'll explain what it does.. Basically you are querying the sqlite database that Address Book.app uses, and having it return a their Organization First and Last name, and of course their email address. This possibly returns multiple rows for each record out of the address book (1 per email address). This seems to work ok for this purpose.
After querying, we are using AWK to put it into something resembling the "Name <email>" format that sup wants it in. I just append the organization name to the Name part.
Alternative that only uses ruby. Requires sqlite3 gem being installed.
contacts=[]
addressbook='~/Library/Application Support/AddressBook/AddressBook-v22.abcddb'
if File.exists?(File.expand_path(addressbook))
require 'sqlite3'
db = SQLite3::Database.new(File.expand_path(addressbook))
sql="select e.ZADDRESSNORMALIZED,p.ZFIRSTNAME,p.ZLASTNAME,p.ZORGANIZATION " +
"from ZABCDRECORD as p,ZABCDEMAILADDRESS as e WHERE e.ZOWNER = p.Z_PK;"
contacts = db.execute(sql).map {|c| "#{c[1]} #{c[2]} #{c[3]} <#{c[0]}>" }
end
contacts