User Tools

Site Tools


muttrc

Objetivo

Permitir ao usuário básico do Mutt melhoria do conhecimento e mostrar técnicas avançadas do Mutt com arquivos exemplos de configuração e dicas de uso. Devido a versatilidade da ferramenta, para cada perfil de usuário, sempre existirá muitas alternativas a ser exploradas.


Dicas Mutt

Enviando e-mail pela linha de comando com log no corpo do e-mail:

mutt -s "Assunto" [email protected] < /var/log/log

Enviando anexo pela linha de comando e texto no corpo do e-mail:

mutt -s "Assunto" [email protected] -a arquivo < /tmp/texto.txt

Emular mailx para compor um e-mail inline

mutt -x

Arquivo de configuração

O arquivo .muttrc é o seu principal arquivo de configuração. Deve ser colocado no home do usuário. Apesar disto, pode-se ter outros arquivo de configuração, devendo para dando ser chamado com a diretiva -F, por exemplo mutt -F meumuttrc. Abaixo um arquivo de exemplo:

~/.muttrc
 
# Mutt - Arquivo principal
 
set sleep_time = 0 
 
#attachments
alias mutt='cd /tmp && mutt'
 
### View URLs inside Mutt
macro index \cb   "|urlview\n"
macro pager \cb   "|urlview\n"
 
# teste de imap
# .mutt/muttrc
 
# .mutt/muttrc
folder-hook 'gmail.com'        'source ~/.mutt/gmail.com'
# switch to default account on startup
source ~/.mutt/gmail.com
 
# index options
set uncollapse_jump                                             # don't collapse on an unread message 
set sort_re                                                     # thread based on regex
set reply_regexp        = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
 
set tilde                                                       # show tildes like in vim
alternative_order text/plain text/enriched text/html            # save html for last
set quote_regexp        = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
 
set date_format         = "%d/%m/%y at %I:%M%P"
set quote_regexp        = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
set reply_regexp        = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
set status_format       = "-%r- %v ───────────/ %f %m%?n? [+%n]?%?d? [-%d]?%?t? [*%t]? /%?p?───/ %p waiting to send /?─%>─(%P)─[ Gmail -]──"
 
# composing mail
set attribution         = "On %d, %n wrote:"                    # set the attribution
set envelope_from                                               # which from?
set forward_decode = no                                              # decode when forwarding
set include                                                     # include message in replies
set realname            = "nome"			                    # who am i?
send-hook   . 'set from=nome@email'
set reverse_name                                                # reply as whomever it was to
set sendmail_wait       = -1                                    # don't wait for sending... to complete
set sig_dashes                                                  # dashes before my sig... sweet
 
# macros
macro index \Cr "<tag-prefix><clear-flag>N" "mark tagged messages as read"
macro index B   "<limit>~b "                "search message bodies"
macro index I   "<change-folder>!<enter>"   "go to Inbox"
 
# save a decoded copy in ~
macro index P   "<pipe-message>cat > ~/"    "save message as"
 
# Lets source the address book and config files
unmy_hdr *
unset use_from
unset use_domain
unset user_agent
 
# Set paths
set editor="/usr/bin/vim  -c 'set tw=74' '+/^$/\n'"	# Edit with vim, wrap at 74 chars, start at the first blank 
 
#abook
set query_command="abook --mutt-query '%s'"	    	# Query abook adressbook
macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
bind editor        <Tab> complete-query
 
set tmpdir="~/.tmp"			             			# Write temp stuff here
 
# Set some options 
 
set xterm_set_titles="yes"
set xterm_title="Mutt %?b?[NEW mail in %b mailboxes]? %f %?m?%m messages&no messages?%?n? [%n NEW]?"
#unset suspend
set wrapmargin=16
set nomark_old 
#set arrow_cursor
 
set abort_nosubject=yes					# Do not abort with no Subject
set abort_unmodified=no					# Do not abort unmodified/empty messages
set allow_8bit				                # Allow 8 bit characters
set ascii_chars=yes					# Use plain ASCII instead of ASC. i like it
set auto_tag						# index function will apply to all tagged messages
set mail_check=150     					# Reduce polling frequency to a sane level 
set timeout=15
set locale=en_US
set send_charset="us-ascii:iso-8859-1:utf-8"
set check_new           				# Check for new messages when mailbox is open
set copy=yes						# Save message for later referece (Sent)
set delete=yes						# Do not ask to delet. Just do it.
set edit_headers=yes					# Permit editing of the headers
set fast_reply=yes					# Do not ask questions when replying
set followup_to						# Set Mail-Followup-To header
set include=yes					    	# Include original when replying
set no help		                      		# display help lines in reverse video mode
set indent_string='}'	               			# string to indent with when replying to
set indent_str="> "
set mask="."						# Show .* files in the file browsers
set pager_stop=yes	                    		# sets if `space` continues to the next message or not
set quit=yes						# Do not ask if i wnat to quit. QUIT
set reply_to=ask-yes					# Ask if i want to reply to Reply-To:
set smart_wrap          				# Wrap the line at the word boundry
set status_on_top=no 				        # Display status line on the top
set confirmcreate=yes
set forward_format="(fwd) %s"
set message_format="%-.16n: %s"
set quote_regexp="^( {0,4}[>|:%]| {0,4}[a-z0-9]+[>|]+)+"
set sort_browser=alpha
 
# compose
set askbcc=no
set askcc=yes
set autoedit=no		# skips the send-menu when set with edit_headers
set forward_edit=yes #no 
set forward_quote 
set header=yes
set honor_followup_to=ask-yes
set ignore_list_reply_to=yes
set postpone=ask-yes
set recall=ask-no
set reply_self=no
set reply_to=no
set metoo=no
set dsn_notify=yes												  
set dsn_return=hdrs
set dsn_notify="failure,delay,sent,read"
 
# Maildir stuff
unset collapse_unread
unset confirmappend					# Do not ask when moving message to another mailbox
unset metoo						# Do not include me when replying
unset markers						# Do not show annyong + when line wraps
unset mark_old         				 	# Do not mark messages old
unset save_empty					# Kill empty mailboxes
 
# Compressed Folder Support
open-hook \\.gz$ "gzip -cd %f > %t"
close-hook \\.gz$ "gzip -c %t > %f"
append-hook \\.gz$ "gzip -c %t >> %f"
open-hook \\.bz2$ "bzip2 -cd %f > %t"
close-hook \\.bz2$ "bzip2 -c %t > %f"
append-hook \\.bz2$ "bzip2 -c %t >> %f"
 
# headers to show
ignore *                                               # ignore all headers
unignore from: to: cc: date: subject:                  # show only these
hdr_order from: to: cc: date: subject:                 # and in this order
 
# Colors
color hdrdefault cyan 			default	      # Make headers cyan
color quoted 	 green 			default	      # Quoted
color signature  red 			default       # Red signatures
color indicator  brightblack 	cyan	              # Indicator line black on cyan
color attachment magenta 		default       # Attachments magenta
color error      brightred 		default	      # Make errors visible
color status 	 brightyellow 	blue		      # Make Status line bright yellow
color tree 	 green 	default		              # Threads green
color normal     white 	default			      # Default white
color message    brightyellow 	default	              # Not sure what this one is....
color header 	 brightyellow 	default ^(Subject)    # Yes. Yellow subject line. I like it like that.
color header     brightcyan		default  "^cc:"
 
color index 	brightyellow 	default "~N"    # New Messages are brighter
color index 	brightyellow 	default "~U"   	# Set Unread meassager same as ~N
color index 	brightred 	default "~F"    # These are important messages
color index 	cyan 		default "~Q"    # Messages i replied to
color index 	brightwhite default "~G"    # PGP Encrypted Message
color index 	brightwhite default "~g"    # PGP Signed Message
color index 	red 		default "~D"    # Deleted Messages
 
 
# Highlights inside the body of a message.
color body 	brightwhite  	default "(http|https|ftp|news|telnet|finger)://[^ \">\t\r\n]*"
color body 	brightwhite  	default "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
color body 	brightwhite  	default "news:[^ \">\t\r\n]*"
color body 	brightgreen  	default "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
color body 	brightblue    	default "<[Gg]>"               # <g>
color body 	brightblue 		default "<[Bb][Gg]>"           # <bg>
color body 	brightblue 		default " [;:]-*[)>(<|]"       # :-) etc...
color body 	brightyellow 	default "\\*[A-Za-z]+\\*"      # *Bold* text.
 
# visualization
macro index \eb '/~b ' 'search in message bodies'
auto_view text/html text/enriched application/x-gunzip \
          application/postscript application/x-tar-gz \
          application/ms-word application/msword
alternative_order text/plain text/html
 
set my_index_format_pre='set index_format="%2C | %Z [%d] %-30.30'
set my_index_format_post=' (%-4.4c) %?M?<%M> ?%s"'
 
folder-hook .*[sS]ent.* "$my_index_format_pre"t"$my_index_format_post"
folder-hook ! .*[sS]ent.* "$my_index_format_pre"F"$my_index_format_post"
 
folder-hook   .*[sS]ent* 'set index_format="%2C | %Z [%d] %-30.30t (%-4.4c) %?M?<%M> ?%s"'
folder-hook ! .*[sS]ent* 'set index_format="%2C | %Z [%d] %-30.30F (%-4.4c) %?M?<%M> ?%s"'
 
# Mailing List Handling
#unlists *               # remove old entries first
lists linux-br ldp-br lie-br mutt-users lists.debian.org
 
unsubscribe *
subscribe linux-br ldp-br lie-br mutt-users lists.debian.org [email protected]
#Pgp Options
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-sign --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="pgpewrap gpg -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 -v --batch --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -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" 
set pgp_getkeys_command=""
set pgp_autosign=no
set pgp_sign_as= 
set pgp_replyencrypt=yes
set pgp_timeout=60
set pgp_good_sign="^gpg: Good signature from"
 
#Formats
set folder_format="%N %d (%5s) %f"       # outros valores  "%2C %-40.40f %d"
set pager_format="%Z %C/%m %d (%F) %s (%c/%l) %|-"
set attach_format="%2n %D%I%u%t %T%f %d (%s) (%m/%M, %e, %C)"
set compose_format="Compose %h [Approx. msg size: %l, Atts: %a] %v %>──"
 
#unset use_domain
unset write_bcc
#unset bounce_delivered
set ignore_list_reply_to
set envelope_from=yes
set envelope_from_address="nome@email"
 
#Local Folders
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates
 
#Security stuff
set move = no  							#Stop asking to "move read messages to mbox"!
set imap_keepalive = 100
 
### For better looks
set markers=no                                                  # don't put '+' at the beginning of wrapped lines
set sort = threads
set sort_aux=reverse-date-received                              # how to sort subthreads last-date-received
set pager_index_lines   = 10                                    # number of index lines to show 
set pager_context       = 3                                     # number of context lines to show
set pager_stop=yes                                              # stop at the end instead of displaying next mail
 
set to_chars="     "						# characters used to indicate mail addressed to you
set alias_format="%4n %t %-12a  %r"     #"%2n %t %-20.20a: %r"
set alias_file= ~/.mutt/aliases
set sort_alias= alias
set reverse_alias=yes
source $alias_file
set resolve														# advance cursor to next message after command
#
#all the emails mutt should consider as being from me.
alternates '(email|nome|altusername)([-+].*)?@.*'
 
### misc.
set beep=yes
set beep_new=yes
set history=66
set ispell=''
set meta_key=no
set visual="exec x mi"
set escape='~'
 
### Print
set print_cmd="muttprintrc"				# Print with muttprint. It rockz. set print_cmd="muttprint -p duplex-letter"
set print=ask-yes 			  		# Ask if i want to print the mesage. Defaults to NO
set print_command="muttprint"
set print_split=no
 
set attach_split        				# Do not treat multiple attachments as one
set fcc_attach						# Save attachment when forwarding 
set mime_forward					# When forwarding attach message as a separate MIME
#unset mime_forward					# forward attachments as part of body
 
### change some keyboard bindings
bind index 	'b'	previous-page
bind index 	' '	next-page
bind index	'R'	group-reply			# reply to all recipients
bind index	'j'	next-entry			# next message, even if deleted
bind index	'k'	previous-entry			# previous message, even if deleted
bind pager 	'b'	previous-page			# jump to previous page in pager
bind pager 	' '	next-page			# jump to next page in pager
bind pager	'N'	search-opposite			# backwards search like less
bind pager	'R'	group-reply			# reply to all recipients
bind pager	'<'	top				# jump to top of message
bind pager	'>'	bottom				# jump to bottom of message
bind generic	'<'	first-entry			# jump to first entry in index
bind generic	'>'	last-entry			# jump to last entry in index
bind attach,index g first-entry
bind attach,index G last-entry
bind index ~ sync-mailbox
bind index P collapse-all
bind index L limit
#bindings -- very  vim-like <<<<------------------- fix this
bind pager i exit
bind index i exit
bind pager /       search
bind pager <up>    previous-line
bind pager <down>  next-line
bind pager k       previous-line
bind pager j       next-line
bind pager gg      top
bind pager G       bottom
bind index gg      first-entry
bind index G       last-entry
bind pager K       previous-undeleted
bind pager J       next-undeleted
bind index K       previous-unread
bind index J       next-unread
bind index x sync-mailbox
macro pager x <sync-mailbox>
 
# set up the sidebar, default not visible
set sidebar_width=25 
set sidebar_visible=yes 
set sidebar_delim='|'
#set sidebar_sort=yes
 
# color of folders with new mail
color sidebar_new yellow default
#
# ctrl-n, ctrl-p to select next, prev folder, ctrl-o to open selected folder
bind index \CP sidebar-prev
bind index \CN sidebar-next
bind index \CO sidebar-open
bind pager \CP sidebar-prev
bind pager \CN sidebar-next
bind pager \CO sidebar-open
#
# b toggles sidebar visibility
macro index b '<enter-command>toggle sidebar_visible<enter>'
macro pager b '<enter-command>toggle sidebar_visible<enter>'
#
# # Remap bounce-message function to "B"
bind index B bounce-message
#
set read_inc=2000	# How often to update the mailbox reading counter
set write_inc=500	# How often to update the mailbox writing counter
set menu_scroll
 
#vim: ft=muttrc

Dúvidas ou sugestões, comente abaixo:

Discussion

Enter your comment. Wiki syntax is allowed:
 
muttrc.txt · Last modified: 2016/09/01 09:54 by fafanet