Posts Tagged ‘google’

mutt and your gmail contacts

Sunday, December 14th, 2008

I was looking for contact sync alternatives for my BlackBerry and came across an announcement that Google Sync for the BlackBerry now includes two-way contact sync. I decided that was good enough reason to start using my GMail contacts, something I never did before since I don’t use the GMail web UI very often.

Other than the BlackBerry I use mutt as a mail user agent. I have a few scripts already written to hook mutt into GMail’s outgoing mail server and Google Calendar so I figured if I was going to use my GMail contacts on the BlackBerry I should shim it into mutt’s contacts as well. In my CVS Web is a small Python script that I wrote to do just that.

If anyone finds any of this useful I’d love to hear about it. Ditto for feature requests, bug reports, or patches.

Mutt and Google Calendar

Monday, October 20th, 2008

I’ve been meaning to throw this out there for a bit. I wrote a little python shim to connect mutt to Google Calendar. My particular use-case is as follows. I use fetchmail to connect to a Microsoft Exchange Server at work which delivers mail into an IMAP account that I check with mutt. Appointments and conference calls show up as .ics files attached to messages. I use Google Calendar connected to my BlackBerry to keep track of all the stuff I do so I need a quick and easy way to get those events out of mutt into my Google Calendar.

Enter ics-gcal.py.

I associate this script to the ics / vcs files and simply exec the attachment from within mutt. This adds it to my Google Calendar.

You can find the script in my CVS web repository.

I’d be super interested if anyone else finds this useful.

mutt and Gmail

Monday, July 7th, 2008

So I have been using gmail more and more lately because one of my friend’s work blocks my normal outgoing mail server. I really dislike webmail interfaces though and usually use mutt(1) as my MUA.
I can use the Gmail’s imap service to read mail, but sending mail is the whole reason I am not using my normal @ub3rgeek.net mail address and it would be nice for the SPF records to match up.

By default mutt(1) uses sendmail(8) to ship your message off to the local MTA, which then takes care of delivering your message. Now I don’t want to smarthost ALL my mail through Gmail’s servers otherwise that would be the easy way out, so the quick and dirty method was to whip up a quick little python program that would act as a SMTP client in place of sendmail(8).

Bits:


# gmail
account-hook imaps://imap.gmail.com/ 'set imap_user=""'
account-hook imaps://imap.gmail.com/ 'set imap_pass=""'
account-hook imaps://imap.gmail.com/ 'set sendmail="/home/mernisse/bin/smtpc.py -s -h smtp.gmail.com -u you@gmail.com -p your_password -f you@gmail.com"'
folder-hook imaps://imap.gmail.com/ 'set from="mernisse@gmail.com"'
folder-hook imaps://imap.gmail.com/ 'set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"'

This is the important part (it is in the imap file in my config), this overrides the other account settings and sets my Gmail username and password for the imaps driver and sets the sendmail binary to my smtpc.py script, passing the arguments for ssl, host smtp.gmail.com, my username and password, as well as the From address. Mutt puts the To: addresses on the command line after all options, since that is what sendmail(8) expects.

You could of course use this to relay to just about any mail server if you like. I continue to set the correct envelope sender, as well as the Sent folder so that the Gmail web interface gets copies of all the replies I send which it happily stuffs into the conversation view.