![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Outdated Tutorials & Tips Outdated Tutorials & Tips |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Still having fun...
![]() Join Date: Dec 2006
Beans: 3,814
|
[Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
*** This thread has been locked at the poster's request. The new version of this howto may be found here ***
================ Introduction ================ This page is a guide to using the email client Mutt to send, receive and read email under Ubuntu using a Gmail account as a relay. Despite the thread title, which speaks of Gutsy Gibbon, this guide should work under most versions of Ubuntu. I am using it myself under Intrepid Ibex with no problems. There are a few steps involved but if followed carefully and in sequence you will soon be using Mutt successfully with your Gmail account. In sequence we will:
Sections that require your details inserted are in bold and red to eliminate some confusion ============ SSL Tools ============ Gmail uses the POP3-over-SSL protocol to protect the transmission of username and password over the Internet. You will need to install open ssl and a certificate pack: Code:
$ sudo apt-get install openssl ca-certificates ========= msmtp ========= msmtp is a great and wonderfully reliable way to move mail from your computer. Download it from the repository as follows: Code:
$ sudo apt-get install msmtp Code:
$ touch $HOME/.msmtprc $ touch $HOME/.msmtp.log $ chmod 0600 $HOME/.msmtprc Code:
account default host smtp.gmail.com port 587 from full.gmail.address@gmail.com tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt auth on user gmail.username password mypassword logfile ~/.msmtp.log ============ Fetchmail ============ Next to download fetchmail from the Ubuntu repository: Code:
$ sudo apt-get install fetchmail Code:
$ vim ~/.fetchmailrc Code:
poll pop.gmail.com # Tell fetchmail about server with proto POP3 # Use the POP-protocol user 'Gmail Username ' # Your Gmail Username there with password 'Gmail Password' # Your Gmail Password is 'username' here # Local Username mda "/usr/bin/procmail -d %T" # Tell fetchmail which MDA to use options # Options duh keep # Keep the mail on server = safe ssl # Use ssl sslcertck # Check the certificates sslcertpath /etc/ssl/certs # Path to the certificates Code:
$ chmod 600 ~/.fetchmailrc Now for the mail delivery program Procmail: =========== Procmail =========== Procmail can be easily downloaded from the repository: Code:
$ sudo apt-get install procmail Code:
$ vim ~/.bashrc Code:
# Sets the Mail Environment Variable MAIL=/var/spool/mail/username && export MAIL Code:
$ vim ~/.procmailrc Code:
# Environment variable assignments PATH=/bin:/usr/bin:/usr/local/bin VERBOSE=off # Turn on for verbose log MAILDIR=$HOME/Mail # Where Procmail recipes deliver LOGFILE=$HOME/.procmaillog # Keep a log for troubleshooting. # Recipes :0: * ^TOmutt-user mutt Code:
$ mkdir $HOME/Mail ======= Mutt ======= The following command downloads mutt from the Ubuntu repository: Code:
$ sudo apt-get install mutt Code:
$ vim ~/.muttrc Code:
#======================================================#
# Boring details
set realname = "Your realname"
set from = "Email address"
set use_from = yes
set envelope_from ="yes"
set sendmail="/usr/bin/msmtp"
# If not set in environment variables:
set spoolfile = /var/spool/mail/user-name
#======================================================#
# Folders
set folder="~/Mail" # Mailboxes in here
set record="+sent" # where to store sent messages
set postponed="+postponed" # where to store draft messages
set move=no # Don't move mail from the spool.
#======================================================#
# Watch these mailboxes for new mail:
mailboxes ! +Fetchmail +slrn +mutt
set sort_browser=alpha # Sort mailboxes by alpha(bet)
#======================================================#
# Order of headers and what to show
hdr_order Date: From: User-Agent: X-Mailer \
To: Cc: Reply-To: Subject:
ignore *
unignore Date: From: User-Agent: X-Mailer \
To: Cc: Reply-To: Subject:
#======================================================#
# which editor do you want to use?
# vim of course!
set editor="vim -c 'set tw=70 et' '+/^$' "
set edit_headers # See the headers when editing
#======================================================#
# Aliases
set sort_alias=alias # sort aliases in alpha order by alias name
#======================================================#
# Colours: This scheme is fairly basic and only
# really works if your Terminal background is white
color hdrdefault black default
color quoted red default
color signature brightblack default
color indicator brightwhite red
color attachment black green
color error red default
color message blue default
color search brightwhite magenta
color status brightyellow blue
color tree red default
color normal blue default
color tilde green default
color bold brightyellow default
color markers red default
#======================================================#
# Odds and ends
set markers # mark wrapped lines of text in the pager with a +
set smart_wrap # Don't wrap mid-word
set pager_context=5 # Retain 5 lines of previous page when scrolling.
set status_on_top # Status bar on top.
push <show-version> # Shows mutt version at startup
Code:
-rw-rw---- 1 andrew mail 0 2008-10-23 10:12 /var/spool/mail/andrew And finally it is reward time as you open Mutt, type ! to open a shell prompt, type fetchmail -v and start reading your mail! My parting gift is a little macro that was written for me by a generous person on the mutt-user mailing list that will actually do this for you when you simply press the key "I". Place the following in your ~/.muttrc file: Code:
macro index,pager I '<shell-escape> fetchmail -v<enter>' October 23rd, 2008 Andrew Strong
__________________
Do you think that's air you're breathing? Last edited by p_quarles; December 25th, 2008 at 11:45 PM.. Reason: Finally turfed ssmtp for msmtp |
|
|
|
|
#2 |
|
Just Give Me the Beans!
![]() |
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
I'd like to report one success.
I had tried to set mutt up a long while ago and always ran into some sort of issue with something, which I imagine is easy when you need to configure three to four programs to set one up correctly, but I went through and followed your post and only had one error (Which was due to me not realizing I had left a space at the end of my gmail username - easily fixed!). Also, I think you also have to turn on POP forwarding in the settings of your gmail account. Not a big deal, unless you don't know about the gmail setting. I have some questions that maybe you can help me with (Or at least point in the right direction In my gmail account I have filters that sort through and apply labels to different emails I receive. Is there a way for mutt to use these labels to sort through? Or maybe that would be procmail that would do that? Thanks for the post, it helped at least one poor soul :] |
|
|
|
|
#3 | |
|
Still having fun...
![]() Join Date: Dec 2006
Beans: 3,814
|
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
Hi,
Glad you had success with the walkthrough: Quote:
All the very best, Andrew
__________________
Do you think that's air you're breathing? |
|
|
|
|
|
#4 | |
|
Just Give Me the Beans!
![]() |
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
Quote:
|
|
|
|
|
|
#5 | |
|
Still having fun...
![]() Join Date: Dec 2006
Beans: 3,814
|
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
Hi,
Had a quick dig in my bookmarks: Quote:
http://lipas.uwasa.fi/~ts/info/proctips.html http://partmaps.org/era/procmail/mini-faq.html For mutt: http://therandymon.com/content/view/42/79/ (This is the Woodnots: highly reccomended!) http://mutt.blackfish.org.uk/ Should get you off to a start Andrew
__________________
Do you think that's air you're breathing? |
|
|
|
|
|
#6 |
|
Just Give Me the Beans!
![]() |
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
And now... imap howto?
|
|
|
|
|
#7 |
|
Still having fun...
![]() Join Date: Dec 2006
Beans: 3,814
|
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
Hi,
Thanks for the suggestion: and it strikes me that this could be a project that you might rmbrace yourself I guess a starting point would be to compile mutt with the appropriate option: --enable-imap ? Andrew
__________________
Do you think that's air you're breathing? |
|
|
|
|
#8 |
|
Dark Roasted Ubuntu
![]() Join Date: Mar 2006
My beans are hidden!
|
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
IMAP with Gmail is real easy, and a lot shorter than what you put up.
Just put a few lines into your muttrc and it works. No compilation or installs neccesary. Code:
set imap_user = 'hug@gmail.com' set spoolfile = imaps://imap.gmail.com:993/INBOX set folder = imaps://imap.gmail.com:993 set record="" #gmail does recording on its own set postponed="imaps://imap.gmail.com/[Gmail]/Drafts" set trash="imaps://imap.gmail.com/[Gmail]/Trash" set realname="Hug M. Not" set from="hug@gmail.com" #maybe these too set imap_check_subscribed="yes" set imap_list_subscribed="yes" set smtp_url="smtp://hug@smtp.gmail.com:587/" set header_cache=~/.mutt/hcache set message_cachedir="~/.mutt/msgcache/" set certificate_file=~/.mutt/certs #and maybe some useful bindings macro index,pager y "<save-message>=[Gmail]/All Mail<enter><enter>" "Archive" macro index,pager d "<save-message>=[Gmail]/Trash<enter><enter>" "Trash" macro index,pager s "<save-message>=[Gmail]/Spam<enter><enter>" "Spam" macro index gi "<change-folder>=INBOX<enter>" "Go to inbox" macro index ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail" macro index gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages" macro index gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts" macro index go "<change-folder>=[Gmail]/Sent Mail<enter>" "Go to sent Mail" macro index gp "<change-folder>=[Gmail]/Spam<enter>" "Go to Spam" |
|
|
|
|
#9 |
|
Just Give Me the Beans!
![]() Join Date: Nov 2006
Beans: 67
|
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
thnx
![]() |
|
|
|
|
#10 | |
|
Still having fun...
![]() Join Date: Dec 2006
Beans: 3,814
|
Re: [Howto] Successfully use Mutt and Gmail on Gutsy Gibbon
Hi,
Read your reply to my mutt walkthrough: Quote:
Once this support has matured certainly this walkthrough will be ready for the archives, although it can easily be modified for standard POP3 accounts. Andrew
__________________
Do you think that's air you're breathing? |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|