Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

HOWTO: Using heirloom-mailx with Gmail

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
MrFrood
Posts: 480
Joined: 2008-04-22 12:08
Location: London UK
Contact:

HOWTO: Using heirloom-mailx with Gmail

#1 Post by MrFrood »

I am assuming that you have already enabled IMAP access for your Gmail
account.


Debian offers two versions of mailx
1: bsd-mailx
2: heirloom-mailx

bsd-mailx is the default so the first thing we need to do is install heirloom-mailx. A the same time we will also install elinks as this will be used to help view html emails.

As root run either of the following command (feel free to use apt if you are more comfortable using it)

Code: Select all

aptitude install heirloom-mailx elinks 

Now we need to configure heirloom-mailx by writing a .mailrc file to the users home directory. Options within account gmail {...} will only apply when invoking heirloom-mailx with the -A flag to use the gmail account. All the options listed below are fully documented in the heirloom-mailx man page.

Copy the sample .mailrc below to ~/.mailrc changing the Gmail username and password to yours and user to the name of the Debian user that will be using heirloom-mailx.

Code: Select all

account gmail {
	set folder=imaps://username@imap.gmail.com
        set password-username@imap.gmail.com="password"
	set imap-use-starttls
	set nss-config-dir=/home/user/.mozilla/firefox/xxxxxxxx.default
	set record=+[Google\ Mail]/Sent\ Mail
	set from="Your Name <username@gmail.com>"
	set replyto="username@gmail.com"
	set sender="username@gmail.com"
        set smtp-auth-password="password"
	set smtp-use-starttls
	set smtp="smtp.gmail.com:587"
	set smtp-auth="login"
	set smtp-auth-user=username@gmail.com

# IMAP SHORTCUTS SECTION for standard Gmail folders
	shortcut allmail +[Google\ Mail]/All\ Mail
	shortcut in +INBOX
	shortcut spam +[Google\ Mail]/Spam
	shortcut trash +[Google\ Mail]/Bin
	shortcut sent +[Google\ Mail]/Sent\ Mail
	}

# Binary options
set askattach
set autoinc
set autothread
set bsdannounce
set bsdflags
set bsdheadline
set bsdmsgs
set bsdorder
set datefield
set dot
set editheaders
set emptystart
set fullnames
set hold
set keep
set markanswered
set print-alternatives
set quiet
set reply-in-same-charset
set showlast
set showname
set showto

# String Options
fwdretain subject date from to
ignore received in-reply-to message-id references
ignore mime-version content-transfer-encoding
retain subject date from to cc x-mailer user-agent mail-system-version mailer originating-client x-newsreader x-mimeole message-id list-id
set autosort=thread
set contenttype-cntrl=text/plain
set crt=20
set encoding=quoted-printable
set headline="%>%a%m %27f  %24d %4l/%-5o %i%S"
set imap-keepalive=240
set imap-list-depth=5
set indentprefix="> "
set newmail=nopoll
set pipe-text/plain="fold -s | less"
set prompt="& "
set quote=headers
set sendcharsets=iso-8859-1,iso-8859-15,utf-8
set signature=/home/user/.signature

# Reading HTML mail
set pipe-text/html="elinks -dump -dump-charset utf-8 -default-mime-type text/html /dev/stdin"

# Address Book
alias  friend1    my_friend@server.foo
Depending on where you are in the world you may need to change

Code: Select all

[Google\ Mail]
to

Code: Select all

[Gmail]
In the line

Code: Select all

set nss-config-dir=/home/user/.mozilla/firefox/xxxxxxxx.default
you will need to change "xxxxxxxx" to whatever it is called on your computer.


All you should need to do now is invoke mailx with the command

Code: Select all

mailx -A gmail
The heirlooom-mailx man page is well written and contains a detailed list of commands for using the program and the options used in the .mailrc above. The options in the sample .mailrc above are ones that work for the way I use heirloom-mailx but feel free to consult the man page and have a play with them.
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.

http://happy.sdf-eul.org/

Post Reply