Re: mutt && Gmail
Andrzej Popielewicz <[email protected]> Fri, 4 Apr 2025 14:58:18 +0100
| Newsgroups | gmane.mail.mutt.user |
|---|---|
| Message-ID | <Z+/[email protected]> |
* Matthias Apitz <[email protected]> [2025-04-03 21:06:47]: > Hello, > > Is it possible to read/write mail with an account at Gmail using IMAPS > and SMTP(S) with mutt? Any working configuration example? > > Thanks > > matthias > > -- > Matthias Apitz, ??? [email protected], http://www.unixarea.de/ +49-176-38902045 > Public GnuPG key: http://www.unixarea.de/key.pub > > Annalena Baerbock: "We are fighting a war against Russia ..." (25.1.2023) > > I, Matthias, I am not at war with Russia. > ?? ???? ???????? ?? ??????????????. > Ich bin nicht im Krieg mit Russland. -- Andrzej Popielewicz
.muttrc
(text/plain, 12.4 KB)
######################################################################
# Andrzej muttrc based on sam #
######################################################################
######################################################################
# mail source #
######################################################################
# folder : specify the mail location, for example ~/Mail. when using
# IMAP, you must set it to your server URI : imap[s]://[user@]host/
#folder-hook "pops://mail.icpnet.pl/" set folder="/tmp/"
# ssl_starttls : tells mutt to use TLS whenever possible. TLS is the
# OpenSSL implementation on a Debian system, so I must set this in
# order to use SSL
set ssl_starttls=ask-yes
#set sendmail=/usr/sbin/sendmail
# imap_authenticators : specify the authentication methods used on the
# IMAP server. this is a list of colon (':') separated method. they
# are tried in the order you specify them here, until one works. in a
# standard IMAP configuration, the IMAP server uses system accounts
# (method 'login')
set imap_authenticators="login:sasl:cram-md5:plain"
set smtp_authenticators="login:sasl:cram-md5:plain"
folder-hook "imaps://imap.gmail.com/" set imap_pass="application_pass"
folder-hook "imaps://imap.gmail.com/" set header_cache="/mnt/.mutt_cache"
folder-hook "imaps://imap.gmail.com/" set imap_user="YourGmailAccountName"
folder-hook "imaps://imap.gmail.com/" set folder="imaps://imap.gmail.com"
set imap_passive=no
#imap_force_ssl : tells mutt to always use SSL when connecting to the
# IMAP server. in my imaps:// setup, this is necessary.
set ssl_force_tls=yes
#set ssl_use_tlsv1=yes
set ssl_use_tlsv1_2=yes
# mail_check : mail check interval. mutt will check for new mail in
# all defined mailboxes (see mailboxes files for more information).
set mail_check=120
# timeout : number of seconds mutt will wait for a key to be pressed
# before timing out and check for new mail.
set timeout=60
# record : tells mutt to backup all outgoing mail in a folder. you'll
# have here to specify the folder format : '=' is for Maildir.
#set record="=INBOX/Sent"
set read_inc=5
set date_format="!%b %d %I:%M"
# postponed : specify the postponed mails (drafts) folder.
#set postponed="=INBOX/Drafts"
lists [email protected] [email protected] [email protected]
subscribe [email protected] [email protected] [email protected]
######################################################################
# include some additionnal configuration snippets #
######################################################################
source ~/.mutt/colors.rc # colors definitions
#source ~/.mutt/mime.rc # s/mime behavior
source ~/.mutt/gpg.rc # gpg support
source ~/.mutt/aliases.rc # aliases (kind of address book)
source ~/.mutt/auto_views.rc # auto views
# NOTE: you must include your mailboxes list *after* setting the
# folder variable, otherwise mutt won't understand where the mailboxes
# refers to.
source ~/.mutt/mailboxes.rc
######################################################################
# host and system #
######################################################################
# hostname : the hostname is appended after the @ in local email
# addresses.
set hostname=gmail.com
# hidden_host : tells mutt not add the hostname when adding the domain
# part to addresses. this avoids having emails like
# '[email protected]'. it's sometimes better to have 'user@domain'.
set hidden_host
# use_domain : when set, mutt will append the domain name to local
# addresses, so 'To: user' becomes 'To: user@domain'.
set use_domain
# header_cache : tells mutt where to store the email headers
# cache. this feature was originaly a patch, but it is included in the
# mutt debian binary package (patch: mutt-cvs-header-cache.21). this
# is a very useful feature since mutt doesn't have to fetch all
# messages headers when entering a folder.
#set header_cache="/usr/local/.mutt_cache/"
#set content_type="text/html"
# nomove : when set, mutt keeps user mail is $MAIL
# (/var/mail/user). this is a personnal choice.
set nomove
######################################################################
# personnal information #
######################################################################
# realname : set it if you need to override the GECOS field. if you
# don't set the from variable, the realname will be used instead.
set realname="Your real name"
# alternates : tells mutt what your email addresses are, using a
# regexp. mutt uses this to avoid including yourself in a 'reply to
# all'.
alternates "((YourGmailAccountName)\@(gmail\.com))"
# signature : if set, mutt will add the traditionnal signature
# separator '-- ', followed by the contents of the given file. if the
# filename ends with a pipe, mutt assumes that the string given is a
# shell commande, and execute it. for example :
# set signature="/usr/bin/fortune |"
set signature=~/.signature
# alias_file : specify the mutt aliases file. this is used when
# creating an alias, contratry to the 'source ...' at the begining of
# the file, that tells mutt to load the aliases.
set alias_file=~/.mutt/aliases.rc
######################################################################
# mutt behavior #
######################################################################
# sort : specify primary sorting order. can be one of : date, from,
# date-received, subject, to, threads, mailbox-order, size, score,
# spam. you can change sort order on the fly in mutt's message listing
# window with 'o'. you may prefix this value with 'reverse-' to
# reverse the sorting order (as in 'reverse-date-received')
folder-hook . set sort=threads
# sort_aux : set the auxiliary sorting order. this value is only used
# when primary sorting by threads. it defines the sub-sorting order or
# the thread. 'date-received' is generaly a good
# idea. 'last-date-received' makes a thread which has just received a
# mail the last one (or first one, depending on your 'reverse-'
# setting) displayed by mutt.
set sort_aux=last-date-received
# sort sent messages by date, using a folder-hook (in order to set the
# rule only for a specified folder)
#folder-hook "=INBOX/Sent" set sort=date-received
# delete : require delete confirmation (for example when syncing
# mailbox or leaving the folder).
set delete=ask-yes
set charset="ISO-8859-2"
# nomark_old : don't mark unread messages as old when leaving the
# folder or exiting mutt.
set nomark_old
#set mark_old
#set hide_thread_subject=no
set pop_last=yes
# reverse_alias : if known in the alias database, display sender name
# instead of email.
set reverse_alias
# strict_threads : tells mutt to determine threading relations
# strictly. mutt will only use the 'In-Reply-To' and 'References'
# headers instead of using 'Subject'. this avoids grouping unrelated
# messages with same subject.
set strict_threads
# [no]pipe_decode : tells mutt [not] to process messages while piping them.
set nopipe_decode
# mailcap_path : where to find mailcap definitions.
# mailcap_sanitize : avoids weird characters to be expanded in
# mailcap % expressions
set mailcap_path=~/.mutt/mailcap.rc:/etc/mailcap
set mailcap_sanitize=yes
######################################################################
# pager (mail viewer) #
######################################################################
# pager_stop : tells pager (mutt's builtin mail viewer) not to switch
# to next message when at the bottom of a mail. if you want to switch
# message, use the array keys (<left> and <right>). the <tab> key will
# jump to the next unread message.
set pager_stop
# pager_context : set the pager context, i.e. the number of lines that
# should be displayed from the previous page when reading a mail.
set pager_context=3
# displayed headers : as in firewall configuration, we first ignore
# all headers. then, we unignore headers we want to be displayed.
# set collapse_unread=no
ignore *
#unignore From From: To Cc Subject Date Reply-To X-Mailer User-Agent Bcc
unignore From From: To Cc Subject Date X-Mailer User-Agent Bcc
# quote_regexp : what we consider to be a quote. this regexp manages
# up to 4 ('{0,4}') levels of quoting, using different quoting
# characters (> | : # %), including some alphanumeric characters (as
# in 'sam> blabla').
set quote_regexp="^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
# alternative_order : specify the order mutt should follow when trying
# to determine which mime multipart attachment to display. wildcards
# can be used (as in 'image/*')
alternative_order text/enriched text/plain text/html
######################################################################
# mail composition #
######################################################################
# editor : overrides the EDITOR environment variable. this specifies,
# of course, the editor launched by mutt when writing an email.
set editor=vi
# include : tells mutt to include message in replies. as always,
# message lines are prefixed with a '>'
set include
set certificate_file="/usr/local/.mutt/certs"
set ssl_usesystemcerts="no"
# edit_headers : always edit message headers. this allows us to add
# Cc: or change subject directly while editing mail.
set edit_headers
# write_bcc : (unset) don't remove the Bcc: header contents.
unset write_bcc
# attribution : this is the string that will precede the message you
# are replying to (when including message, as we do).
# %n: sender name
# %a: sender email
# %Y-%m-%d: date in YYYY-mm-dd format
# %H:%M:%S: time in HH:MM:SS format
# %{...}: converts date and time information to our timezone.
set attribution="* %n <%a> [%{%Y-%m-%d %H:%M:%S}]:\n"
# mime_forward : tells mutt to forward messages as MIME attachments.
set forw_format="[fwd] %s (from: %a)" # A different subject for forwarded messages
set mime_forward=ask-yes
set forward_quote # quote the header and body of forward msgs
# defaults headers ('folder-hook .' applies to all folders)
my_hdr X-Operating-System: Your OS
my_hdr X-Mailer: mutt-2.1.4
#my_hdr X-PGP-Key: pgp.mit.edu
#my_hdr X-PGP-Key-Id: xxxxxxx
folder-hook "imap.gmail.com" my_hdr From: [email protected]
folder-hook "smtp.gmail.com" my_hdr From: [email protected]
folder-hook "imap.gmail.com" my_hdr Reply-To: [email protected]
folder-hook "imap.gmail.com" set ssl_use_tlsv1_2=yes
folder-hook "imap.gmail.com" set ssl_use_tlsv1=no
folder-hook "imap.gmail.com" set ssl_use_tlsv1_1=no
#
# You create application pass after login into Your Gmail account in browser
#
folder-hook "imap.gmail.com" \
set smtp_url="smtps://YourGmailAccountName:[email protected]:465"
# it seems , that gmail imap server writes a copy anyway
# so if You set record, sent email will be written twice !!
# it is probable , that I have defined my gmail acount in such a way,
# using different email agent, for example Thunderbird or Android agent(??).
#folder-hook "imap.gmail.com" set record="=[Gmail]/Wysłane"
# copy of sent email is written to local folder /Mail/Sent
fcc-hook *.* "/dev/null"
# it is the same problem as above, but at least is written to
# different mailbox. Mutt inserts Fcc header to sent email, so fcc-hook must
# be used, but perhaps, there is a way to set null mailbox (/dev/null ?) ??
folder-hook "imap.gmail.com" set postponed="=Drafts"
folder-hook "smtp.gmail.com" set ssl_use_tlsv1_2=no
folder-hook "smtp.gmail.com" set ssl_use_tlsv1_1=yes
folder-hook "smtp.gmail.com" set ssl_use_tlsv1=no
folder-hook "smtps://imap.amu.edu.pl/" set ssl_use_tlsv1_2=yes
folder-hook "imaps://cyrus.andrew.cmu.edu/archive.cyrus-sasl/" \
set ssl_use_tlsv1=yes
folder-hook "imaps://cyrus.andrew.cmu.edu/archive.cyrus-sasl/" \
set ssl_use_tlsv1_1=no
folder-hook "imaps://cyrus.andrew.cmu.edu/archive.cyrus-sasl/" \
set ssl_use_tlsv1_2=no
macro index,attach <f5> '<view-attachments>/html<enter>| "/usr/bin/lynx0"<enter>' 'display html attachment'
macro index,attach <f6> '<view-attachments>/html<enter>| "/usr/bin/lynx1"<enter>' 'display html attachment'
######################################################################
# last, but not least, get mutt to display its version on startup #
######################################################################
push <show-version>