unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jed Brown <jed@59A2.org>
To: Brett Viren <brett.viren@gmail.com>, Jjgod Jiang <gzjjgod@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: Guide for new users?
Date: Sun, 22 Nov 2009 18:02:36 +0100	[thread overview]
Message-ID: <87zl6ev6fn.fsf@kunyang.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <46263c600911220641m4d6de6d9u190d41c3feb87bc7@mail.gmail.com>

On Sun, 22 Nov 2009 09:41:16 -0500, Brett Viren <brett.viren@gmail.com> wrote:
> On Sat, Nov 21, 2009 at 11:44 PM, Jjgod Jiang <gzjjgod@gmail.com> wrote:
> 
> > 1. What's the most efficient way to sync mails from my gmail
> > account to a local Maildir? I've tried offlineimap but it
> > keeps crashing python (!) on my system (python 2.6, Mac OS X
> > 10.6.2).
> 
> OfflineIMAP would have been my suggestion.

Yes, however it will change flags which changes file names and currently
confuses notmuch.  I synced [Gmail].All Mail with OfflineIMAP and am now
using Getmail to pull via POP.  In the Gmail settings, activate POP
starting at the current time.  I'll switch back to OfflineIMAP when
notmuch is happy with changing file names.

The following should save notmuch + Gmail users some time.


~/.getmail/gmail:

[retriever]
# Getmail can also do IMAP
# type = SimpleIMAPSSLRetriever
# server = imap.gmail.com
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = yourname@gmail.com
password = Pa55W0rd
# Use this with IMAP to only download one copy of each message
# mailboxes = ('[Gmail]/All Mail',)

[destination]
type = Maildir
path = ~/.mail-archive/gmail/pop/

[options]
# print messages about each action (verbose = 2)
# Other options:
# 0 prints only warnings and errors
# 1 prints messages about retrieving and deleting messages only
verbose = 2
message_log = ~/.getmail/gmail.log


With getmail, put something like this in your crontab (checks every 2
minutes)

# MIN HOUR DAY MONTH DAYOFWEEK   COMMAND
*/2 * * * * getmail -r gmail && notmuch new




~/.offlineimaprc:

[general]
accounts = GMail
maxsyncaccounts = 1
ui = Noninteractive.Basic

[Account GMail]
localrepository = Local
remoterepository = Remote
autorefresh = 1
quick = 10
postsynchook = notmuch new

[Repository Local]
type = Maildir
localfolders = /home/jed/.mail-archive/gmail/imap

[Repository Remote]
type = Gmail
folderfilter = lambda foldername: foldername in ['[Gmail]/All Mail']
remotehost = imap.gmail.com
remoteuser = yourname@gmail.com
remotepass = Pa55W0rd
ssl = yes
maxconnections = 2

#Setting realdelete = yes will Really Delete email from the server.
#Otherwise "deleting" a message will just remove any labels and
#retain the message in the All Mail folder.
realdelete = no




Note that with IMAP, your messages in '[Gmail]/All Mail' will be
delivered to a path with spaces which notmuch handles fine, but you will
need a patch

  <1258771074-25997-1-git-send-email-jed@59A2.org>

for start-process-shell-command, e.g. to apply patches from within emacs via

  | git am



* Sending messages

To send messages from Emacs via Gmail, put something like this in your ~/.emacs

(setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)) ; Must be set BEFORE loading smtpmail
      smtpmail-auth-credentials (expand-file-name "~/.authinfo")
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      smtpmail-debug-info t ; change to nil once it works
      smtpmail-debug-verb t)
(require 'smtpmail)
(setq message-send-mail-function 'smtpmail-send-it)
(require 'starttls)


you can inline authentication, but especially if you keep ~/.emacs under
version control, you should put it separately (chmod 600).

~/.authinfo:

machine smtp.gmail.com login yourname@gmail.com password Pa55W0rd port 587


* Git
Git + Gmail users can use git send-email by putting this in your
.gitconfig

[sendemail]
        smtpserver = smtp.gmail.com
        smtpserverport = 587
        smtpencryption = tls
        smtpuser = yourname@gmail.com
        smtppass = Pa55W0rd



I hope this helps.

Jed

  reply	other threads:[~2009-11-22 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-22  4:44 Guide for new users? Jjgod Jiang
2009-11-22 14:41 ` Brett Viren
2009-11-22 17:02   ` Jed Brown [this message]
2009-11-23  1:44     ` Carl Worth
2009-11-23  1:37 ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zl6ev6fn.fsf@kunyang.i-did-not-set--mail-host-address--so-tickle-me \
    --to=jed@59a2.org \
    --cc=brett.viren@gmail.com \
    --cc=gzjjgod@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).