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
Code: Select all
[Google\ Mail]
Code: Select all
[Gmail]
Code: Select all
set nss-config-dir=/home/user/.mozilla/firefox/xxxxxxxx.default
All you should need to do now is invoke mailx with the command
Code: Select all
mailx -A gmail