mutt : a different mail client

Le ultime esigenze mi hanno spinto a cercare un client testuale , in grado di accedere alla mia posta che risiede su una macchina a cui accedo via SSH , qui ho trovato in mutt un valido aiuto.

Direi che l’esperienza è stata positiva , mutt non sembra facile da configurare ma in giro per la rete si trovano molti esempi da cui è possibile estrapolare quel che serve per personalizzare sia l’interfaccia che le funzioni a disposizione.

Alcuni link da tenere sempre a portata di mano :  Il Nirvana con mutt e  la documentazione ufficiale di mutt .

 

Occorre infine acquistare un pò di abilità con la tastiera perchè tutte le funzioni vanno date senza l’ausilio del mouse , dopo un pò di pratica e con un pò di aiuto dal binding i risultati saranno proporzionali all’impegno dedicato.

La configurazione usata è idonea per una connessione a un server di posta con IMAP , ma per capire meglio la mia condizione faccio una breve introduzione alla macchina cui accedo.

La macchina in oggetto è il mio server di posta , che più che un server è un relay e storage , preleva la posta con fetchmail e poi dopo esser passata tra postfix,clamav,spamassassin e infine procmail viene consegnata all’untente nella sua home in formato IMAP..

Accedendo con SSH eseguo il login con l’utente che riceve la posta e da qui eseguo mutt.

Il file principale di configurazione va creato e si chiama .muttrc al suo interno vanno inserite le indicazioni necessarie, in questa prima parte trattiamo l’accesso IMAP , il cestino non viene usato , per cancellare eseguo un purge oppure sposto la mail nel cestino ‘s‘.

set imap_user = "user"
set imap_pass = "password"
set folder = imap://localhost/
set spoolfile = imap://localhost/INBOX/
set record = imap://localhost/INBOX/Inviata
set postponed = imap://localhost/INBOX/Bozze
#set trash = imap://localhost/INBOX/Cestino/

Alcune opzioni sul login , opzionale header_cache che mi ha dato problemi con diversi segmentation failt nel fetching

# wait to enter mailbox manually
unset imap_passive
# Automatically poll subscribed mailboxes for new mail (new in 1.5.11)
set imap_check_subscribed
# keep a cache of headers for faster loading (1.5.9+?)
#set header_cache=~/.hcache
# Display download progress every 5K
set net_inc=5

In questa parte aggiungo la vista dell’anno sulla riga delle mail

#Set the index_format variable to include all manner of different details about each message.
#In particular, the %d format string, which inserts the date formatted according to the value of date_format
#or one of the other date format strings, such as %{fmt}, %[fmt], etc.
set index_format="%4C %Z %[!%b %d %Y] %-17.17F (%3l) %s"

Occorre installare mutt-patched per avere la sidebar , bind a ‘B‘ per nasconderla o farla comparire

#Sidebar
set sidebar_width=25
set sidebar_visible=yes
set sidebar_delim='|'
color sidebar_new yellow default
bind index,pager \CP sidebar-prev
bind index,pager \CN sidebar-next
bind index,pager \CO sidebar-open
macro generic,index,pager B '<enter-command>toggle sidebar_visible<enter><refresh>'

Alcune indicazioni per migliorare l’aspetto grafico

# brighten up stuff with colours, for more colouring examples see:
# http://aperiodic.net/phil/configs/mutt/colors
color normal      white          black
color hdrdefault  green          default
color quoted      green          default
color quoted1     yellow         default
color quoted2     brightblue     default
color signature   cyan           default
color indicator   brightyellow   red
color error       brightred      default
color status      brightwhite    blue
color tree        brightmagenta  black
color tilde       blue           default
color attachment  brightyellow   default
color markers     brightred      default
color message     white          black
color search      brightwhite    magenta
color bold        brightyellow   default
color index brightyellow default ~N
color index brightred default ~D
set send_charset="utf-8"
color header brightgreen default ^(From|Subject):
color body cyan default "(ftp|http|https)://[^ ]+"   # point out URLs
color body cyan default [-a-z_0-9.]+@[-a-z_0-9.]+    # e-mail addresses
color underline brightgreen default

Bind di alcune funzioni utili come ‘c‘ o il movimento nei menù con le frecce

 bind  pager   <up>     previous-line
 bind  pager   <down>   next-line
 bind  pager   <left>   exit
 bind  pager   <right>  view-attachments
 bind  attach  <left>   exit
 bind  attach  <right>  view-attach
 bind  index   <right>  display-message
 macro index   <left>   "<change-folder>?" "Select folder"
 bind  browser <right>  select-entry
 macro browser <left>   "<exit><change-folder>!<Enter>" "Return to folder"
#Add macros to make the folder browser usable by always using the mailboxes setup above
 macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
 macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder"

Le preferenze su chi invia la posta

# set from to ensure mutt doesn't put user@localhost.localhost 
set from="barabba@libero.it"
set use_from=yes
set envelope_from="yes"

# set realname
set realname="barabba"

una rubrica a portata di mano , occorre installare il pacchetto abook , poi con la funzione ‘a‘ si inseriscono nomi,mail e alias per poterli richiamare comodamenrte quando si invia una mail con ‘TAB‘ , occoregenreare il file .mutt-alias.

# abook info
set alias_file=~/.mutt-alias
source ~/.mutt-alias
set query_command= "abook --mutt-query '%s'"
macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"

La firma da inserire nelle mail inviate , generare il file .signature e modificare a piacere

# firma della mail
set signature="~/.signature"

Se si possiede una chiave GPG qui la si può gestire comodamente per firmare/veridicare firme o cryptare/decryptare messaggi , abilitare le opzioni desiderate commentando o decommentando quelle presenti

IMPORTANTE sostituite il valore della chiave 44F2EC89 con il vostro

#gpg set
set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sig --textmode %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x44FIGA89 -- -r %r -- %f"
set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x44FIGA89 -- -r %r -- %f"
set pgp_import_command="gpg --no-verbose --import -v %f"
set pgp_export_command="gpg --no-verbose --export --armor %r"
set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" 
set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" 

# specify the uid to use when encrypting/signing
set pgp_sign_as=44FIGA89

# this set the number of seconds to keep in memory the passpharse used to encrypt/sign
# the more the less secure it will be
set pgp_timeout=1800

# it's a regexp used against the GPG output: if it matches some line of the output
# then mutt considers the message a good signed one (ignoring the GPG exit code)
set pgp_good_sign="^gpg: Good signature from"

# mutt uses by default PGP/GPG to sign/encrypt messages
# if you want to use S-mime instead set the smime_is_default variable to yes

# automatically sign all outgoing messages
#set crypt_autosign
# sign only replies to signed messages
#set crypt_replysign

# automatically sign
#set pgp_autosign=yes
# automatically encrypt outgoing messages
#set crypt_autoencrypt=no
# encrypt only replies to signed messages
#set crypt_replyencrypt=yes
# encrypt and sign replies to encrypted messages
#set crypt_replysignencrypted=yes
# automatically verify the sign of a message when opened
set crypt_verify_sig=yes

Questa la lascio come optional , se decommentata manda  una copia nascosta ogni volta che inviamo una mail all’indirizzo specificato , lo usata per alcuni test ora in stand-by

#auto bcc to me
#my_hdr Bcc:nopope@libero.it

Questo per ora è tutto , anche se è possibile implementare altre funzion utili o interessanti a seconda delle esigenze.

my .muttrc :

😉  Happy mail.

Rispondi

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.