The Lumber Room

"Consign them to dust and damp by way of preserving them"

Posts Tagged ‘debian

Using Gmail with mutt, the minimal way (IMAP update)

with 74 comments

As Gmail has IMAP access, it is fairly trivial to get it working with mutt. First, if you’re on Ubuntu/Debian, run sudo apt-get install openssl mutt to get mutt if you don’t already have it. Then, just put the following lines into your ~/.muttrc:

set imap_user = "username@gmail.com"
set imap_pass = "password"

set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = "password"
set from = "username@gmail.com"
set realname = "Your Real Name"

set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no

Make sure your ~/.muttrc isn’t world-readable; it contains your password. (Alternatively, you can leave them out and mutt will prompt you for the password each time.) Also, if you copy-paste from the above, make sure that you have only “normal” quotes, not “smart quotes” which WordPress might have inserted here into this post.

[Other things I have:

set sort = 'threads'
set sort_aux = 'last-date-received'
set imap_check_subscribed

ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc

I did not include above to justify the “minimal” :)]

Things work perfectly as you would expect them.
One thing to note is that the full headers will still contain the hostname of the computer you send messages from. I have not figured a way of hiding this, and perhaps it shouldn’t be possible.

The End

If for some reason you want to use POP, read on. And tell me why you would want to use POP. The rest of the post is an old version, which i had written before Gmail supported IMAP.

Old Stuff
There is a guide here, which is the first Google result on searching for the keywords Gmail, mutt and Ubuntu in any order, but I would advise against it: it does too much unnecessary stuff using too many unnecessary programs (okay if you don’t care), and involves putting your username and password in a world-readable file (not okay).

There is a guide here, but that site seems down, and so I guess it’s likely to be down again (a DynDNS domain; could be someone’s house), so putting a (fuller) guide here:

First, run sudo apt-get install openssl mutt

Next, in /etc/ssmtp/ssmtp.conf, put
mailhub=smtp.gmail.com:465
UseTLS=YES

Everything else seems to be optional.

Next, create a shell script with the contents
#!/bin/sh
/usr/sbin/ssmtp -au "gmail-address" -ap "password" $@
and put it somewhere in your path (~/bin/gmailout, say) and make it executable (chmod u+x ~/bin/gmailout, I mean) and make sure only you can read it! (chmod og-r ~/bin/gmailout).

Now in ~/.muttrc, put
set pop_host="pops://username:password@pop.gmail.com:995"
set pop_last
unset pop_delete #Just makes mutt not ask, GMail uses config option
set sendmail="~/bin/gmailout"
set write_bcc=no #Important; sSMTP makes bcc non-blind otherwise

and you’re set (remember to make this world-unreadable too: chmod og-rw ~/.muttrc)

You can start mutt, and hit “G” (uppercase G) whenever you want to fetch mail. Can also put exec fetch-mail in ~/.muttrc to have it happen whenever you start mutt, but I find that irritating.

Problems with POP: Not that everything is perfect. I can’t have other mail-transport-agents like sendmail or postfix installed alongside ssmtp. I can’t figure out how to get my crontab reports sent to root, but they do go into ~/dead.letter :D
Also, with mutt I had the habit of adding a my_hdr bcc: my-email-address so that the mail I send is threaded along with the mail I receive (yaay, like Gmail), but somehow there seems to be simply no way of getting Gmail to give me, through POP, those messages I send using an external client. It’s a quirk [bug!] in the way Gmail implements POP. This I’ve fixed by setting mutt’s fcc to /var/mail/my-username, my mail folder. (Of course, if I were in the habit of moving mail to my mbox, I could fcc to mbox too.)
Apart from that, it works fine!

Advertisement

Written by S

Tue, 2007-07-31 at 02:16:03

Debian/Ubuntu: Find out which packages are taking the most space

leave a comment »

There is a package called debian-goodies (that’s what it’s called on Ubuntu as well :-)) which has this utility called dpigs — for telling you which packages are “pigging out” on your system. (So install it with sudo apt-get install debian-goodies, and then run dpigs). This and other utilities, from the description:

 debget       - Fetch a .deb for a package in APT's database
 dpigs        - Show which installed packages occupy the most space
 debman       - Easily view man pages from a binary .deb without extracting
 checkrestart - Help to find and restart processes which are using old
                versions of upgraded files (such as libraries)
 popbugs      - Display a customized release-critical bug list based on
                packages you use (using popularity-contest data)

Nice.

Written by S

Tue, 2007-02-06 at 02:20:17

Posted in compknow

Tagged with , ,

Symbol’s function definition is void: outline-font-lock-level

with one comment

Using Emacs and todoo-mode (the todoo library / todoo.el).
I got the message

Symbol’s function definition is void: outline-font-lock-level

whenever I tried to insert a new sub-item (using C-c M-i which is bound to todoo-insert-sub-item) in my TODO file. Searching Google gave someone’s old diary, from which (although it’s in Japanese ;-)) I found that it’s related to Debian bug 244681: emacs-goodies-el: todoo.el doesn’t work at XEmacs21. I’m using GNU Emacs 22.0.92.1 and not XEmacs, though.

Update: Before you try the “fixes” below (and in the comment), try just downloading the latest version from Debian. It appears that this got reported as bug 447760, and got fixed.

Anyway, the fix (I haven’t learnt Emacs lisp, so this may be far from the “best” way to do it):

  1. Open the todoo.el file (M-x find-library RET todoo RET) and find the todoo-insert-sub-item function. (Better, use C-h f todoo-insert-sub-item RET and follow the link.)
  2. Replace (outline-font-lock-level) with a value, like 3 or something. You might also want to do the same in the other place that (outline-font-lock-level) is used — in the function todoo-indent-line
  3. Another solution, if you don’t want to / can’t edit the file (no permissions, for example), might be to define the function (outline-font-lock-level) — put (defun outline-font-lock-level nil 3) somewhere.

    Another solution might be to redefine the function entirely. This requires knowledge that I don’t have, but, for example, making some local transformations, I replaced it with this:

    (defun todoo-insert-sub-item ()
      "Insert a new todoo-sub-item."
      (interactive)
      (goto-char (- (todoo-item-end) 1))
      (insert (concat (make-string todoo-indent-column ? )
                      todoo-sub-item-marker " \n"))
      (backward-char))

    The space after the ? is important.

Written by S

Sun, 2007-02-04 at 20:14:31

dpkg error: trying to overwrite X, which is also in package Y

with 20 comments

For an error like this:

dpkg: error processing /var/cache/apt/archives/AAA (--unpack):
trying to overwrite `/usr/lib/BBB', which is also in package CCC
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
AAA
E: Sub-process /usr/bin/dpkg returned an error code (1)

(where AAA,BBB,CCC are placeholder names, in case it wasn’t clear)
do

sudo dpkg -i --force-overwrite AAA

(give full path of AAA), and then run

sudo apt-get -f install

again.

Written by S

Sun, 2006-04-16 at 10:51:00

Posted in compknow

Tagged with , , , ,