Monday, April 27, 2009

using mutt with gmail - google apps account

It was easy to set up gmail app account on mutt to fetch email, but sending was a pain.

The problem was user id containing "@" symbol. For example exampleuser@exampledomain.com and gmail requiring smtp authentication for sending emails. Mutt config file gives no option to set user for smtp seperately. So it has to be passed in "smtp_url" variable.

set smtp_url = "smtp://exampleuser@exampledomain.com@smtp.gmail.com:587"

But this gives error cause mutt tries to find domain exampledomain.com instead of smtp.gmail.com.

The solution was to use the variable "imap_user".
set smtp_url = "smtp://$imap_user@smtp.gmail.com:587"

Hope that helps.