feat: msmtp additions
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@ storage/second_brain/*
|
||||
storage/maildir/*
|
||||
storage/pass/*
|
||||
cradle/home/.config/aerc/accounts.conf
|
||||
cradle/home/.mbsyncrc
|
||||
|
||||
868
cradle/home/.config/aerc/aerc.conf
Normal file
868
cradle/home/.config/aerc/aerc.conf
Normal file
@@ -0,0 +1,868 @@
|
||||
#
|
||||
# aerc main configuration
|
||||
|
||||
[general]
|
||||
#
|
||||
# Used as a default path for save operations if no other path is specified.
|
||||
# ~ is expanded to the current user home dir.
|
||||
#
|
||||
#default-save-path=
|
||||
|
||||
# If set to "gpg", aerc will use system gpg binary and keystore for all crypto
|
||||
# operations. If set to "internal", the internal openpgp keyring will be used.
|
||||
# If set to "auto", the system gpg will be preferred unless the internal
|
||||
# keyring already exists, in which case the latter will be used.
|
||||
#
|
||||
# Default: auto
|
||||
#pgp-provider=auto
|
||||
|
||||
# By default, the file permissions of accounts.conf must be restrictive and
|
||||
# only allow reading by the file owner (0600). Set this option to true to
|
||||
# ignore this permission check. Use this with care as it may expose your
|
||||
# credentials.
|
||||
#
|
||||
# Default: false
|
||||
#unsafe-accounts-conf=false
|
||||
|
||||
# Output log messages to specified file. A path starting with ~/ is expanded to
|
||||
# the user home dir. When redirecting aerc's output to a file using > shell
|
||||
# redirection, this setting is ignored and log messages are printed to stdout.
|
||||
#
|
||||
#log-file=
|
||||
|
||||
# Only log messages above the specified level to log-file. Supported levels
|
||||
# are: trace, debug, info, warn and error. When redirecting aerc's output to
|
||||
# a file using > shell redirection, this setting is ignored and the log level
|
||||
# is forced to trace.
|
||||
#
|
||||
# Default: info
|
||||
#log-level=info
|
||||
|
||||
# Disable IPC entirely. Don't run commands (including mailto:... and mbox:...)
|
||||
# in an existing aerc instance, and don't start an IPC server to allow
|
||||
# subsequent aerc instances to run commands in the current one.
|
||||
#
|
||||
# Default: false
|
||||
#disable-ipc=false
|
||||
|
||||
# Don't run mailto:... commands over IPC; start a new aerc instance with the
|
||||
# composer instead.
|
||||
#
|
||||
# Default: false
|
||||
#disable-ipc-mailto=false
|
||||
#
|
||||
# Don't run mbox:... commands over IPC; start a new aerc instance with the mbox
|
||||
# file instead.
|
||||
#
|
||||
# Default: false
|
||||
#disable-ipc-mbox=false
|
||||
|
||||
# Set the $TERM environment variable used for the embedded terminal.
|
||||
#
|
||||
# Default: xterm-256color
|
||||
#term=xterm-256color
|
||||
|
||||
# Display OSC8 strings in the embedded terminal
|
||||
#
|
||||
# Default: false
|
||||
#enable-osc8=false
|
||||
|
||||
# Default shell command to use for :menu. This will be executed with sh -c and
|
||||
# will run in an popover dialog.
|
||||
#
|
||||
# Any occurrence of %f will be replaced by a temporary file path where the
|
||||
# command is expected to write output lines to be consumed by :menu. Otherwise,
|
||||
# the lines will be read from the command's standard output.
|
||||
#
|
||||
# Examples:
|
||||
# default-menu-cmd=fzf
|
||||
# default-menu-cmd=fzf --multi
|
||||
# default-menu-cmd=dmenu -l 20
|
||||
# default-menu-cmd=ranger --choosefiles=%f
|
||||
#
|
||||
#default-menu-cmd=
|
||||
|
||||
[ui]
|
||||
#
|
||||
# Describes the format for each row in a mailbox view. This is a comma
|
||||
# separated list of column names with an optional align and width suffix. After
|
||||
# the column name, one of the '<' (left), ':' (center) or '>' (right) alignment
|
||||
# characters can be added (by default, left) followed by an optional width
|
||||
# specifier. The width is either an integer representing a fixed number of
|
||||
# characters, or a percentage between 1% and 99% representing a fraction of the
|
||||
# terminal width. It can also be one of the '*' (auto) or '=' (fit) special
|
||||
# width specifiers. Auto width columns will be equally attributed the remaining
|
||||
# terminal width. Fit width columns take the width of their contents. If no
|
||||
# width specifier is set, '*' is used by default.
|
||||
#
|
||||
# Default: flags:4,name<20%,subject,date>=
|
||||
#index-columns=flags:4,name<20%,subject,date>=
|
||||
|
||||
#
|
||||
# Each name in index-columns must have a corresponding column-$name setting.
|
||||
# All column-$name settings accept golang text/template syntax. See
|
||||
# aerc-templates(7) for available template attributes and functions.
|
||||
#
|
||||
# Here are some examples to show the To field instead of the From field for
|
||||
# an email (modifying column-name):
|
||||
#
|
||||
# 1. a generic one
|
||||
# column-name={{ .Peer | names | join ", " }}
|
||||
# 2. based upon the selected folder
|
||||
# column-name={{if match .Folder "^(Gesendet|Sent)$"}}{{index (.To | names) 0}}{{else}}{{index (.From | names) 0}}{{end}}
|
||||
#
|
||||
# Default settings
|
||||
#column-flags={{.Flags | join ""}}
|
||||
#column-name={{index (.From | names) 0}}
|
||||
#column-subject={{.ThreadPrefix}}{{.Subject}}
|
||||
#column-date={{.DateAutoFormat .Date.Local}}
|
||||
|
||||
#
|
||||
# String separator inserted between columns. When the column width specifier is
|
||||
# an exact number of characters, the separator is added to it (i.e. the exact
|
||||
# width will be fully available for the column contents).
|
||||
#
|
||||
# Default: " "
|
||||
#column-separator=" "
|
||||
|
||||
#
|
||||
# See time.Time#Format at https://godoc.org/time#Time.Format
|
||||
#
|
||||
# Default: 2006 Jan 02
|
||||
#timestamp-format=2006 Jan 02
|
||||
|
||||
#
|
||||
# Index-only time format for messages that were received/sent today.
|
||||
# If this is empty, timestamp-format is used instead.
|
||||
#
|
||||
# Default: 15:04
|
||||
#this-day-time-format=15:04
|
||||
|
||||
#
|
||||
# Index-only time format for messages that were received/sent within the last
|
||||
# 7 days. If this is empty, timestamp-format is used instead.
|
||||
#
|
||||
# Default: Jan 02
|
||||
#this-week-time-format=Jan 02
|
||||
|
||||
#
|
||||
# Index-only time format for messages that were received/sent this year.
|
||||
# If this is empty, timestamp-format is used instead.
|
||||
#
|
||||
#Default: Jan 02
|
||||
#this-year-time-format=Jan 02
|
||||
|
||||
#
|
||||
# Overrides timestamp-format for the message view.
|
||||
#
|
||||
# Default: 2006 Jan 02, 15:04 GMT-0700
|
||||
#message-view-timestamp-format=2006 Jan 02, 15:04 GMT-0700
|
||||
|
||||
#
|
||||
# If set, overrides timestamp-format in the message view for messages
|
||||
# that were received/sent today.
|
||||
#
|
||||
#message-view-this-day-time-format=
|
||||
|
||||
# If set, overrides timestamp-format in the message view for messages
|
||||
# that were received/sent within the last 7 days.
|
||||
#
|
||||
#message-view-this-week-time-format=
|
||||
|
||||
#
|
||||
# If set, overrides *timestamp-format* in the message view for messages
|
||||
# that were received/sent this year.
|
||||
#
|
||||
#message-view-this-year-time-format=
|
||||
|
||||
#
|
||||
# Width of the sidebar, including the border.
|
||||
#
|
||||
# Default: 22
|
||||
#sidebar-width=22
|
||||
|
||||
#
|
||||
# Default split layout for message list tabs. The syntax is:
|
||||
#
|
||||
# [<direction>] <size>
|
||||
#
|
||||
# <direction> is optional and defaults to horizontal. It can take one
|
||||
# of the following values: h, horiz, horizontal, v, vert, vertical.
|
||||
#
|
||||
# <size> is a positive integer representing the size (in terminal cells)
|
||||
# of the message list window.
|
||||
#
|
||||
#message-list-split=
|
||||
|
||||
#
|
||||
# Message to display when viewing an empty folder.
|
||||
#
|
||||
# Default: (no messages)
|
||||
#empty-message=(no messages)
|
||||
|
||||
# Message to display when no folders exists or are all filtered
|
||||
#
|
||||
# Default: (no folders)
|
||||
#empty-dirlist=(no folders)
|
||||
#
|
||||
# Value to set {{.Subject}} template to when subject is empty.
|
||||
#
|
||||
# Default: (no subject)
|
||||
#empty-subject=(no subject)
|
||||
|
||||
# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
|
||||
#
|
||||
# Default: false
|
||||
#mouse-enabled=false
|
||||
|
||||
#
|
||||
# Ring the bell when new messages are received
|
||||
#
|
||||
# Default: true
|
||||
#new-message-bell=true
|
||||
|
||||
#
|
||||
# Template to use for Account tab titles
|
||||
#
|
||||
# Default: {{.Account}}
|
||||
#tab-title-account={{.Account}}
|
||||
|
||||
#
|
||||
# Template to use for Composer tab titles
|
||||
#
|
||||
# Default: {{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}}
|
||||
#tab-title-composer={{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}}
|
||||
|
||||
#
|
||||
# Template to use for Message Viewer tab titles
|
||||
#
|
||||
# Default: {{.Subject}}
|
||||
#tab-title-viewer={{.Subject}}
|
||||
|
||||
|
||||
# Marker to show before a pinned tab's name.
|
||||
#
|
||||
# Default: `
|
||||
#pinned-tab-marker='`'
|
||||
|
||||
# Template for the left side of the directory list.
|
||||
# See aerc-templates(7) for all available fields and functions.
|
||||
#
|
||||
# Default: {{.Folder}}
|
||||
#dirlist-left={{.Folder}}
|
||||
|
||||
# Template for the right side of the directory list.
|
||||
# See aerc-templates(7) for all available fields and functions.
|
||||
#
|
||||
# Default: {{if .Unread}}{{humanReadable .Unread}}{{end}}
|
||||
#dirlist-right={{if .Unread}}{{humanReadable .Unread}}{{end}}
|
||||
|
||||
# Delay after which the messages are actually listed when entering a directory.
|
||||
# This avoids loading messages when skipping over folders and makes the UI more
|
||||
# responsive. If you do not want that, set it to 0s.
|
||||
#
|
||||
# Default: 200ms
|
||||
#dirlist-delay=200ms
|
||||
|
||||
# Display the directory list as a foldable tree that allows to collapse and
|
||||
# expand the folders.
|
||||
#
|
||||
# Default: false
|
||||
#dirlist-tree=false
|
||||
|
||||
# If dirlist-tree is enabled, set level at which folders are collapsed by
|
||||
# default. Set to 0 to disable.
|
||||
#
|
||||
# Default: 0
|
||||
#dirlist-collapse=0
|
||||
|
||||
# List of space-separated criteria to sort the messages by, see *sort*
|
||||
# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
|
||||
# reverses that criterion.
|
||||
#
|
||||
# Example: "from -r date"
|
||||
#
|
||||
#sort=
|
||||
|
||||
# Moves to next message when the current message is deleted
|
||||
#
|
||||
# Default: true
|
||||
#next-message-on-delete=true
|
||||
|
||||
# Automatically set the "seen" flag when a message is opened in the message
|
||||
# viewer.
|
||||
#
|
||||
# Default: true
|
||||
#auto-mark-read=true
|
||||
|
||||
# The directories where the stylesets are stored. It takes a colon-separated
|
||||
# list of directories. If this is unset or if a styleset cannot be found, the
|
||||
# following paths will be used as a fallback in that order:
|
||||
#
|
||||
# ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets
|
||||
# ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets
|
||||
# /usr/local/share/aerc/stylesets
|
||||
# /usr/share/aerc/stylesets
|
||||
#
|
||||
#stylesets-dirs=
|
||||
|
||||
# Uncomment to use box-drawing characters for vertical and horizontal borders.
|
||||
#
|
||||
# Default: "│" and "─"
|
||||
#border-char-vertical="│"
|
||||
#border-char-horizontal="─"
|
||||
|
||||
# Sets the styleset to use for the aerc ui elements.
|
||||
#
|
||||
# Default: default
|
||||
#styleset-name=default
|
||||
|
||||
# Activates fuzzy search in commands and their arguments: the typed string is
|
||||
# searched in the command or option in any position, and need not be
|
||||
# consecutive characters in the command or option.
|
||||
#
|
||||
# Default: false
|
||||
#fuzzy-complete=false
|
||||
|
||||
# How long to wait after the last input before auto-completion is triggered.
|
||||
#
|
||||
# Default: 250ms
|
||||
#completion-delay=250ms
|
||||
|
||||
# The minimum required characters to allow auto-completion to be triggered after
|
||||
# completion-delay.
|
||||
#
|
||||
# Setting this to "manual" disables automatic completion, leaving only the
|
||||
# manually triggered completion with the $complete key (see aerc-binds(5) for
|
||||
# more details).
|
||||
#
|
||||
# Default: 1
|
||||
#completion-min-chars=1
|
||||
|
||||
#
|
||||
# Global switch for completion popovers
|
||||
#
|
||||
# Default: true
|
||||
#completion-popovers=true
|
||||
|
||||
# Uncomment to use UTF-8 symbols to indicate PGP status of messages
|
||||
#
|
||||
# Default: ASCII
|
||||
#icon-unencrypted=
|
||||
#icon-encrypted=✔
|
||||
#icon-signed=✔
|
||||
#icon-signed-encrypted=✔
|
||||
#icon-unknown=✘
|
||||
#icon-invalid=⚠
|
||||
|
||||
# Reverses the order of the message list. By default, the message list is
|
||||
# ordered with the newest (highest UID) message on top. Reversing the order
|
||||
# will put the oldest (lowest UID) message on top. This can be useful in cases
|
||||
# where the backend does not support sorting.
|
||||
#
|
||||
# Default: false
|
||||
#reverse-msglist-order = false
|
||||
|
||||
# Reverse display of the message threads. Default order is the initial
|
||||
# message is on the top with all the replies being displayed below. The
|
||||
# reverse option will put the initial message at the bottom with the
|
||||
# replies on top.
|
||||
#
|
||||
# Default: false
|
||||
#reverse-thread-order=false
|
||||
|
||||
# Positions the cursor on the last message in the message list (at the
|
||||
# bottom of the view) when opening a new folder.
|
||||
#
|
||||
# Default: false
|
||||
#select-last-message=false
|
||||
|
||||
# Sort the thread siblings according to the sort criteria for the messages. If
|
||||
# sort-thread-siblings is false, the thread siblings will be sorted based on
|
||||
# the message UID in ascending order. This option is only applicable for
|
||||
# client-side threading with a backend that enables sorting. Note that there's
|
||||
# a performance impact when sorting is activated.
|
||||
#
|
||||
# Default: false
|
||||
#sort-thread-siblings=false
|
||||
|
||||
# Set the scroll offset in number of lines from the top and bottom of the
|
||||
# message list.
|
||||
#
|
||||
# Default: 0
|
||||
#msglist-scroll-offset = 0
|
||||
|
||||
#
|
||||
# Enable a threaded view of messages. If this is not supported by the backend
|
||||
# (IMAP server or notmuch), threads will be built by the client.
|
||||
#
|
||||
# Default: false
|
||||
#threading-enabled=false
|
||||
|
||||
# Force client-side thread building
|
||||
#
|
||||
# Default: false
|
||||
#force-client-threads=false
|
||||
|
||||
# If no References nor In-Reply-To headers can be matched to build client side
|
||||
# threads, fallback to similar subjects.
|
||||
#
|
||||
# Default: false
|
||||
#threading-by-subject=false
|
||||
|
||||
# Show thread context enables messages which do not match the current query (or
|
||||
# belong to the current mailbox) to be shown for context. These messages can be
|
||||
# styled separately using "msglist_thread_context" in a styleset. This feature
|
||||
# is not supported by all backends
|
||||
#
|
||||
# Default: false
|
||||
#show-thread-context=false
|
||||
|
||||
# Debounce client-side thread building
|
||||
#
|
||||
# Default: 50ms
|
||||
#client-threads-delay=50ms
|
||||
|
||||
#
|
||||
# Thread prefix customization:
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the arrow head.
|
||||
#
|
||||
# Default: ">"
|
||||
#thread-prefix-tip = ">"
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the arrow indentation.
|
||||
#
|
||||
# Default: " "
|
||||
#thread-prefix-indent = " "
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the vertical extension of
|
||||
# the arrow.
|
||||
#
|
||||
# Default: "│"
|
||||
#thread-prefix-stem = "│"
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the horizontal extension
|
||||
# of the arrow.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-limb = ""
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the folded thread
|
||||
# indicator.
|
||||
#
|
||||
# Default: "+"
|
||||
#thread-prefix-folded = "+"
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the unfolded thread
|
||||
# indicator.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-unfolded = ""
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the first child connector.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-first-child = ""
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the connector used if
|
||||
# the message has siblings.
|
||||
#
|
||||
# Default: "├─"
|
||||
#thread-prefix-has-siblings = "├─"
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the connector used if the
|
||||
# message has no parents and no children.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-lone = ""
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the connector used if the
|
||||
# message has no parents and has children.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-orphan = ""
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the connector for the last
|
||||
# sibling.
|
||||
#
|
||||
# Default: "└─"
|
||||
#thread-prefix-last-sibling = "└─"
|
||||
|
||||
#
|
||||
# Customize the reversed thread prefix appearance by selecting the connector for
|
||||
# the last sibling.
|
||||
#
|
||||
# Default: "┌─"
|
||||
#thread-prefix-last-sibling-reverse = "┌─"
|
||||
|
||||
#
|
||||
# Customize the thread prefix appearance by selecting the connector for dummy
|
||||
# thread.
|
||||
#
|
||||
# Default: "┬─"
|
||||
#thread-prefix-dummy = "┬─"
|
||||
|
||||
#
|
||||
# Customize the reversed thread prefix appearance by selecting the connector for
|
||||
# dummy thread.
|
||||
#
|
||||
# Default: "┴─"
|
||||
#thread-prefix-dummy-reverse = "┴─"
|
||||
|
||||
#
|
||||
# Customize the reversed thread prefix appearance by selecting the first child
|
||||
# connector.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-first-child-reverse = ""
|
||||
|
||||
#
|
||||
# Customize the reversed thread prefix appearance by selecting the connector
|
||||
# used if the message has no parents and has children.
|
||||
#
|
||||
# Default: ""
|
||||
#thread-prefix-orphan-reverse = ""
|
||||
|
||||
[statusline]
|
||||
#
|
||||
# Describes the format for the status line. This is a comma separated list of
|
||||
# column names with an optional align and width suffix. See [ui].index-columns
|
||||
# for more details. To completely mute the status line except for push
|
||||
# notifications, explicitly set status-columns to an empty string.
|
||||
#
|
||||
# Default: left<*,center:=,right>*
|
||||
#status-columns=left<*,center:=,right>*
|
||||
|
||||
#
|
||||
# Each name in status-columns must have a corresponding column-$name setting.
|
||||
# All column-$name settings accept golang text/template syntax. See
|
||||
# aerc-templates(7) for available template attributes and functions.
|
||||
#
|
||||
# Default settings
|
||||
#column-left=[{{.Account}}] {{.StatusInfo}}
|
||||
#column-center={{.PendingKeys}}
|
||||
#column-right={{.TrayInfo}} | {{cwd}}
|
||||
|
||||
#
|
||||
# String separator inserted between columns.
|
||||
# See [ui].column-separator for more details.
|
||||
#
|
||||
#column-separator=" "
|
||||
|
||||
# Specifies the separator between grouped statusline elements.
|
||||
#
|
||||
# Default: " | "
|
||||
#separator=" | "
|
||||
|
||||
# Defines the mode for displaying the status elements.
|
||||
# Options: text, icon
|
||||
#
|
||||
# Default: text
|
||||
#display-mode=text
|
||||
|
||||
[viewer]
|
||||
#
|
||||
# Specifies the pager to use when displaying emails. Note that some filters
|
||||
# may add ANSI codes to add color to rendered emails, so you may want to use a
|
||||
# pager which supports ANSI codes.
|
||||
#
|
||||
# Default: less -Rc
|
||||
#pager=less -Rc
|
||||
|
||||
#
|
||||
# If an email offers several versions (multipart), you can configure which
|
||||
# mimetype to prefer. For example, this can be used to prefer plaintext over
|
||||
# html emails.
|
||||
#
|
||||
# Default: text/plain,text/html
|
||||
#alternatives=text/plain,text/html
|
||||
|
||||
#
|
||||
# Default setting to determine whether to show full headers or only parsed
|
||||
# ones in message viewer.
|
||||
#
|
||||
# Default: false
|
||||
#show-headers=false
|
||||
|
||||
#
|
||||
# Layout of headers when viewing a message. To display multiple headers in the
|
||||
# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
|
||||
# none of their specified headers are present in the message.
|
||||
#
|
||||
# Default: From|To,Cc|Bcc,Date,Subject
|
||||
#header-layout=From|To,Cc|Bcc,Date,Subject
|
||||
|
||||
# Whether to always show the mimetype of an email, even when it is just a single part
|
||||
#
|
||||
# Default: false
|
||||
#always-show-mime=false
|
||||
|
||||
# Define the maximum height of the mimetype switcher before a scrollbar is used.
|
||||
# The height of the mimetype switcher is restricted to half of the display
|
||||
# height. If the provided value for the height is zero, the number of parts will
|
||||
# be used as the height of the type switcher.
|
||||
#
|
||||
# Default: 0
|
||||
#max-mime-height = 0
|
||||
|
||||
# Parses and extracts http links when viewing a message. Links can then be
|
||||
# accessed with the open-link command.
|
||||
#
|
||||
# Default: true
|
||||
#parse-http-links=true
|
||||
|
||||
[compose]
|
||||
#
|
||||
# Specifies the command to run the editor with. It will be shown in an embedded
|
||||
# terminal, though it may also launch a graphical window if the environment
|
||||
# supports it. Defaults to $EDITOR, or vi.
|
||||
editor=nvim
|
||||
|
||||
#
|
||||
# When set, aerc will create and read .eml files for composing that have
|
||||
# non-standard \n linebreaks. This is only relevant if the used editor does not
|
||||
# support CRLF linebreaks.
|
||||
#
|
||||
#lf-editor=false
|
||||
|
||||
#
|
||||
# Default header fields to display when composing a message. To display
|
||||
# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
|
||||
#
|
||||
# Default: To|From,Subject
|
||||
#header-layout=To|From,Subject
|
||||
|
||||
#
|
||||
# Edit headers into the text editor instead than separate fields.
|
||||
#
|
||||
# When this is true, address-book-cmd is not supported and address completion
|
||||
# is left to the editor itself. Also, displaying multiple headers on the same
|
||||
# line is not possible.
|
||||
#
|
||||
# Default: false
|
||||
#edit-headers=false
|
||||
|
||||
#
|
||||
# Sets focus to the email body when the composer window opens.
|
||||
#
|
||||
# Default: false
|
||||
#focus-body=false
|
||||
|
||||
#
|
||||
# Specifies the command to be used to tab-complete email addresses. Any
|
||||
# occurrence of "%s" in the address-book-cmd will be replaced with what the
|
||||
# user has typed so far.
|
||||
#
|
||||
# The command must output the completions to standard output, one completion
|
||||
# per line. Each line must be tab-delimited, with an email address occurring as
|
||||
# the first field. Only the email address field is required. The second field,
|
||||
# if present, will be treated as the contact name. Additional fields are
|
||||
# ignored.
|
||||
#
|
||||
# This parameter can also be set per account in accounts.conf.
|
||||
#address-book-cmd=
|
||||
|
||||
# Specifies the command to be used to select attachments. Any occurrence of
|
||||
# '%s' in the file-picker-cmd will be replaced with the argument <arg>
|
||||
# to :attach -m <arg>. Any occurrence of '%f' will be replaced by the
|
||||
# location of a temporary file, from which aerc will read the selected files.
|
||||
#
|
||||
# If '%f' is not present, the command must output the selected files to
|
||||
# standard output, one file per line. If it is present, then aerc does not
|
||||
# capture the standard output and instead reads the files from the temporary
|
||||
# file which should have the same format.
|
||||
#file-picker-cmd=
|
||||
|
||||
#
|
||||
# Allow to address yourself when replying
|
||||
#
|
||||
# Default: true
|
||||
#reply-to-self=true
|
||||
|
||||
# Warn before sending an email with an empty subject.
|
||||
#
|
||||
# Default: false
|
||||
#empty-subject-warning=false
|
||||
|
||||
#
|
||||
# Warn before sending an email that matches the specified regexp but does not
|
||||
# have any attachments. Leave empty to disable this feature.
|
||||
#
|
||||
# Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The
|
||||
# "(?im)" flags are set by default (case-insensitive and multi-line).
|
||||
#
|
||||
# Example:
|
||||
# no-attachment-warning=^[^>]*attach(ed|ment)
|
||||
#
|
||||
#no-attachment-warning=
|
||||
|
||||
#
|
||||
# When set, aerc will generate "format=flowed" bodies with a content type of
|
||||
# "text/plain; format=flowed" as described in RFC3676. This format is easier to
|
||||
# handle for some mailing software, and generally just looks like ordinary
|
||||
# text. To actually make use of this format's features, you'll need support in
|
||||
# your editor.
|
||||
#
|
||||
#format-flowed=false
|
||||
|
||||
[multipart-converters]
|
||||
#
|
||||
# Converters allow to generate multipart/alternative messages by converting the
|
||||
# main text/plain part into any other MIME type. Only exact MIME types are
|
||||
# accepted. The commands are invoked with sh -c and are expected to output
|
||||
# valid UTF-8 text.
|
||||
#
|
||||
# Example (obviously, this requires that you write your main text/plain body
|
||||
# using the markdown syntax):
|
||||
#text/html=pandoc -f markdown -t html --standalone
|
||||
|
||||
[filters]
|
||||
#
|
||||
# Filters allow you to pipe an email body through a shell command to render
|
||||
# certain emails differently, e.g. highlighting them with ANSI escape codes.
|
||||
#
|
||||
# The commands are invoked with sh -c. The following folders are prepended to
|
||||
# the system $PATH to allow referencing filters from their name only:
|
||||
#
|
||||
# ${XDG_CONFIG_HOME:-~/.config}/aerc/filters
|
||||
# ~/.local/libexec/aerc/filters
|
||||
# ${XDG_DATA_HOME:-~/.local/share}/aerc/filters
|
||||
# $PREFIX/libexec/aerc/filters
|
||||
# $PREFIX/share/aerc/filters
|
||||
# /usr/libexec/aerc/filters
|
||||
# /usr/share/aerc/filters
|
||||
#
|
||||
# If you want to run a program in your default $PATH which has the same name
|
||||
# as a builtin filter (e.g. /usr/bin/colorize), use its absolute path.
|
||||
#
|
||||
# The following variables are defined in the filter command environment:
|
||||
#
|
||||
# AERC_MIME_TYPE the part MIME type/subtype
|
||||
# AERC_FORMAT the part content type format= parameter
|
||||
# AERC_FILENAME the attachment filename (if any)
|
||||
# AERC_SUBJECT the message Subject header value
|
||||
# AERC_FROM the message From header value
|
||||
#
|
||||
# The first filter which matches the email's mimetype will be used, so order
|
||||
# them from most to least specific.
|
||||
#
|
||||
# You can also match on non-mimetypes, by prefixing with the header to match
|
||||
# against (non-case-sensitive) and a comma, e.g. subject,text will match a
|
||||
# subject which contains "text". Use header,~regex to match against a regex.
|
||||
#
|
||||
text/plain=colorize
|
||||
text/calendar=calendar
|
||||
message/delivery-status=colorize
|
||||
message/rfc822=colorize
|
||||
#text/html=pandoc -f html -t plain | colorize
|
||||
text/html=! html
|
||||
#text/html=! w3m -T text/html -I UTF-8
|
||||
#text/*=bat -fP --file-name="$AERC_FILENAME"
|
||||
#application/x-sh=bat -fP -l sh
|
||||
#image/*=catimg -w $(tput cols) -
|
||||
#subject,~Git(hub|lab)=lolcat -f
|
||||
#from,thatguywhodoesnothardwraphismessages=wrap -w 100 | colorize
|
||||
|
||||
# This special filter is only used to post-process email headers when
|
||||
# [viewer].show-headers=true
|
||||
# By default, headers are piped directly into the pager.
|
||||
#
|
||||
.headers=colorize
|
||||
|
||||
[openers]
|
||||
#
|
||||
# Openers allow you to specify the command to use for the :open and :open-link
|
||||
# actions on a per-MIME-type basis. The :open-link URL scheme is used to
|
||||
# determine the MIME type as follows: x-scheme-handler/<scheme>.
|
||||
#
|
||||
# {} is expanded as the temporary filename or URL to be opened with proper
|
||||
# shell quoting. If it is not encountered in the command, the filename/URL will
|
||||
# be appended to the end of the command. The command will then be executed with
|
||||
# `sh -c`.
|
||||
#
|
||||
# Like [filters], openers support basic shell globbing. The first opener which
|
||||
# matches the part's MIME type (or URL scheme handler MIME type) will be used,
|
||||
# so order them from most to least specific.
|
||||
#
|
||||
# Examples:
|
||||
# x-scheme-handler/irc=hexchat
|
||||
# x-scheme-handler/http*=printf '%s' {} | wl-copy
|
||||
# text/html=surf -dfgms
|
||||
# text/plain=gvim {} +125
|
||||
# message/rfc822=thunderbird
|
||||
x-scheme-handler/http = firefox
|
||||
x-scheme-handler/https = firefox
|
||||
|
||||
[hooks]
|
||||
#
|
||||
# Hooks are triggered whenever the associated event occurs.
|
||||
|
||||
#
|
||||
# Executed when a new email arrives in the selected folder
|
||||
#mail-received=notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] New mail from $AERC_FROM_NAME" "$AERC_SUBJECT"
|
||||
|
||||
#
|
||||
# Executed when mail is deleted from a folder
|
||||
#mail-deleted=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
|
||||
|
||||
#
|
||||
# Executed when aerc adds mail to a folder
|
||||
#mail-added=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
|
||||
|
||||
#
|
||||
# Executed when aerc starts
|
||||
#aerc-startup=aerc :terminal calcurse && aerc :next-tab
|
||||
|
||||
#
|
||||
# Executed when aerc shuts down.
|
||||
#aerc-shutdown=
|
||||
|
||||
#
|
||||
# Executed when notmuch tags are modified.
|
||||
#tag-modified=
|
||||
|
||||
#
|
||||
# Executed when flags are changed on a message.
|
||||
#flag-changed=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" &
|
||||
|
||||
[templates]
|
||||
# Templates are used to populate email bodies automatically.
|
||||
#
|
||||
|
||||
# The directories where the templates are stored. It takes a colon-separated
|
||||
# list of directories. If this is unset or if a template cannot be found, the
|
||||
# following paths will be used as a fallback in that order:
|
||||
#
|
||||
# ${XDG_CONFIG_HOME:-~/.config}/aerc/templates
|
||||
# ${XDG_DATA_HOME:-~/.local/share}/aerc/templates
|
||||
# /usr/local/share/aerc/templates
|
||||
# /usr/share/aerc/templates
|
||||
#
|
||||
#template-dirs=
|
||||
|
||||
# The default template to be used for new messages.
|
||||
#
|
||||
# default: new_message
|
||||
#new-message=new_message
|
||||
|
||||
# The default template to be used for quoted replies.
|
||||
#
|
||||
# default: quoted_reply
|
||||
#quoted-reply=quoted_reply
|
||||
|
||||
# The default template to be used for forward as body.
|
||||
#
|
||||
# default: forward_as_body
|
||||
#forwards=forward_as_body
|
||||
@@ -61,9 +61,10 @@ listen_on unix:~/.config/kitty/.kitty_socket
|
||||
strip_trailing_spaces smart
|
||||
|
||||
# --- Keybinds
|
||||
kitty_mod ctrl+shift
|
||||
map kitty_mod+c copy_to_clipboard
|
||||
map kitty_mod+v paste_from_clipboard
|
||||
kitty_mod shift+alt
|
||||
map ctrl+shift+c copy_to_clipboard
|
||||
map ctrl+shift+v paste_from_clipboard
|
||||
map ctrl+q quit
|
||||
map kitty_mod+enter launch --cwd=current --type os-window
|
||||
map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R
|
||||
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
# Copyright (C) 2025, Jamie Albert
|
||||
# ---
|
||||
|
||||
# ---
|
||||
# Script Exports
|
||||
# ---
|
||||
declare -x PASSWORD_STORE_DIR=~/dao/storage/pass
|
||||
declare -x BW_SESSION; BW_SESSION=$(pass show bw/session)
|
||||
|
||||
# ---
|
||||
# Script globals
|
||||
# ---
|
||||
declare -g _cached_uh=""
|
||||
declare -g _uh_cache_key=""
|
||||
declare -g _cached_pyenv_version=""
|
||||
|
||||
80
in_progress/scripts/weather.sh
Executable file
80
in_progress/scripts/weather.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ---
|
||||
# @source: https://gitlab.com/julianfairfax/scripts/-/blob/main/add-location-to-gnome-weather.sh
|
||||
# ---
|
||||
|
||||
if [[ ! -z "$(which gnome-weather)" ]]; then
|
||||
system=1
|
||||
fi
|
||||
|
||||
if [[ ! -z "$(flatpak list | grep org.gnome.Weather)" ]]; then
|
||||
flatpak=1
|
||||
fi
|
||||
|
||||
if [[ ! $system == 1 && ! $flatpak == 1 ]]; then
|
||||
echo "GNOME Weather isn't installed"
|
||||
exit
|
||||
fi
|
||||
|
||||
language=$(locale | sed -n 's/^LANG=\([^_]*\).*/\1/p')
|
||||
|
||||
if [[ ! -z "$*" ]]; then
|
||||
query="$*"
|
||||
else
|
||||
read -p "Type the name of the location you want to add to GNOME Weather: " query
|
||||
fi
|
||||
|
||||
query="$(echo $query | sed 's/ /+/g')"
|
||||
|
||||
request=$(curl "https://nominatim.openstreetmap.org/search?q=$query&format=json&limit=1" -H "Accept-Language: $language" -s)
|
||||
|
||||
if [[ $request == "[]" ]]; then
|
||||
echo "No locations found, consider removing some search terms"
|
||||
exit
|
||||
fi
|
||||
|
||||
read -p "If this is not the location you wanted, consider adding search terms
|
||||
Are you sure you want to add $(echo $request | sed 's/.*"display_name":"//' | sed 's/".*//')? [y/n] : " answer
|
||||
|
||||
if [[ ! $answer == "y" ]]; then
|
||||
echo "Not adding location"
|
||||
exit
|
||||
else
|
||||
echo "Adding location"
|
||||
fi
|
||||
|
||||
name=$(echo $request | sed 's/.*"name":"//' | sed 's/".*//' | sed 's/ /-/g')
|
||||
|
||||
|
||||
lat=$(echo $request | sed 's/.*"lat":"//' | sed 's/".*//')
|
||||
lat=$(echo "$lat / (180 / 3.141592654)" | bc -l)
|
||||
|
||||
lon=$(echo $request | sed 's/.*"lon":"//' | sed 's/".*//')
|
||||
lon=$(echo "$lon / (180 / 3.141592654)" | bc -l)
|
||||
|
||||
if [[ $system == 1 ]]; then
|
||||
locations=$(gsettings get org.gnome.Weather locations)
|
||||
fi
|
||||
|
||||
if [[ $flatpak == 1 ]]; then
|
||||
locations=$(flatpak run --command=gsettings org.gnome.Weather get org.gnome.Weather locations)
|
||||
fi
|
||||
|
||||
location="<(uint32 2, <('$name', '', false, [($lat, $lon)], @a(dd) [])>)>"
|
||||
|
||||
if [[ $system == 1 ]]; then
|
||||
if [[ ! $(gsettings get org.gnome.Weather locations) == "@av []" ]]; then
|
||||
gsettings set org.gnome.Weather locations "$(echo $locations | sed "s|>]|>, $location]|")"
|
||||
else
|
||||
gsettings set org.gnome.Weather locations "[$location]"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $flatpak == 1 ]]; then
|
||||
if [[ ! $(flatpak run --command=gsettings org.gnome.Weather get org.gnome.Weather locations) == "@av []" ]]; then
|
||||
flatpak run --command=gsettings org.gnome.Weather set org.gnome.Weather locations "$(echo $locations | sed "s|>]|>, $location]|")"
|
||||
else
|
||||
flatpak run --command=gsettings org.gnome.Weather set org.gnome.Weather locations "[$location]"
|
||||
fi
|
||||
fi
|
||||
30
scripts/on_demand/msmtp-queue.sh
Normal file
30
scripts/on_demand/msmtp-queue.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##--------------------------------------------------------------
|
||||
##
|
||||
## msmtp-queue : wrapper script for msmtpq
|
||||
## to expose the management functions
|
||||
## for the msmtp queue
|
||||
## Copyright (C) 2011 Chris Gianniotis
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or, at
|
||||
## your option, any later version.
|
||||
##
|
||||
##--------------------------------------------------------------
|
||||
|
||||
## msmtp-queue
|
||||
## is only a wrapper
|
||||
## it invokes the queue management functions of msmtpq
|
||||
## by calling it as msmtpq --q-mgmt
|
||||
##
|
||||
## all configuration and documentation is in the msmtpq script
|
||||
|
||||
## note that for 'special circumstances'
|
||||
## (e.g. embedded systems, etc.)
|
||||
## where the msmtpq script itself is not on the path
|
||||
## change the below line to be
|
||||
## exec /path/to/msmtpq --q-mgmt
|
||||
|
||||
exec msmtpq --q-mgmt "$1"
|
||||
646
scripts/on_demand/msmtpq.sh
Normal file
646
scripts/on_demand/msmtpq.sh
Normal file
@@ -0,0 +1,646 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##--------------------------------------------------------------
|
||||
##
|
||||
## msmtpq : queue funtions to both use & manage the msmtp queue,
|
||||
## as it was defined by Martin Lambers
|
||||
## Copyright (C) 2008 - 2015 Chris Gianniotis
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or, at
|
||||
## your option, any later version.
|
||||
##
|
||||
##--------------------------------------------------------------
|
||||
##
|
||||
## msmtpq is meant to be used by an email client - in 'sendmail' mode
|
||||
## for this purpose, it is invoked directly as 'msmtpq'
|
||||
## it is also meant to be used to maintain the msmtp queue
|
||||
## when it is evoked by the wrapper script 'msmtp-queue'
|
||||
## (which calls this script as msmtpq --q-mgmt)
|
||||
##
|
||||
## there is a queue log file, distinct from the msmtp log,
|
||||
## for all events & operations on the msmtp queue
|
||||
## that is defined below
|
||||
##
|
||||
## (mutt users, using msmtpq in 'sendmail' mode,
|
||||
## should make at least the following two settings in their .muttrc
|
||||
## set sendmail = /path/to/msmtpq
|
||||
## set sendmail_wait = -1
|
||||
##
|
||||
## please see the msmtp man page and docs for further mutt settings
|
||||
## and optimisations
|
||||
## )
|
||||
|
||||
## msmtpq can use the following environment variables :
|
||||
## EMAIL_CONN_NOTEST if set will suppress any testing for a connection
|
||||
## (the above var is deprecated & will be removed ; use the var below)
|
||||
## EMAIL_CONN_TEST if =x will suppress any testing for a connection
|
||||
## if =p or unset will use a ping test (debian.org) for a connection
|
||||
## if =P will use a fast ping test (8.8.8.8) for a connection
|
||||
## if =n will use netcat (nc) to test for a connection
|
||||
## if =s will use bash sockets to test for a connection
|
||||
## EMAIL_QUEUE_QUIET if set will cause suppression of messages and 'chatter'
|
||||
## (perhaps useful for some of the emacs mail clients)
|
||||
## NOTIFY_SEND if set to 1 then notify-send sends error messages to the desktop;
|
||||
## set to 1 by default whenever possible if terminal has no output;
|
||||
## set to any other value to forcibly suppress these messages
|
||||
## NOTIFY_SEND_VERBOSE if set then notify-send sends all messages to the desktop
|
||||
##
|
||||
## ======================================================================================
|
||||
## !!! define or confirm the following vars if you wish to set !!!
|
||||
## !!! these properties here in the script - the same properties !!!
|
||||
## !!! may be set externally, by means of environment variables !!!
|
||||
## !!! note the internal variables, if set, will take precedence !!!
|
||||
## !!! over properties set via environment variables !!!
|
||||
## ======================================================================================
|
||||
##
|
||||
#EMAIL_CONN_NOTEST=y # deprecated ; use below var
|
||||
#EMAIL_CONN_TEST={x| |p|P|n|s} # see settings above for EMAIL_CONN_TEST
|
||||
## ======================================================================================
|
||||
|
||||
## two essential patches by Philipp Hartwig
|
||||
## 19 Oct 2011 & 27 Oct 2011
|
||||
##
|
||||
##--------------------------------------------------------------
|
||||
## the msmtp queue contains unique filenames of the following form :
|
||||
## two files for each mail in the queue
|
||||
##
|
||||
## creates new unique filenames of the form :
|
||||
## MLF: ccyy-mm-dd-hh.mm.ss[-x].mail -- mail file
|
||||
## MSF: ccyy-mm-dd-hh.mm.ss[-x].msmtp -- msmtp commands file
|
||||
## where x is a consecutive number only appended for uniqueness
|
||||
## if more than one mail per second is sent
|
||||
##--------------------------------------------------------------
|
||||
|
||||
# exit on error or pipe error:
|
||||
set -o errtrace -o errexit -o pipefail
|
||||
# optionally debug output by supplying TRACE=1
|
||||
[[ "${TRACE:-0}" == "1" ]] && set -o xtrace
|
||||
|
||||
bash_has_min_version() {
|
||||
(( ( BASH_VERSINFO[0] > $1 )
|
||||
|| ( BASH_VERSINFO[0] == $1 && BASH_VERSINFO[1] >= $2 ) ))
|
||||
}
|
||||
|
||||
# see https://git.savannah.gnu.org/gitweb/?p=bash.git;a=blob;f=NEWS;hb=6794b5478f660256a1023712b5fc169196ed0a22#l654
|
||||
if bash_has_min_version 4 4 ; then
|
||||
if [ "$POSIXLY_CORRECT" = "y" ]; then
|
||||
shopt -s inherit_errexit 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
IFS=$' \n\t'
|
||||
PS4='+\t '
|
||||
|
||||
# desktop notifications handling
|
||||
if [ -n "$NOTIFY_SEND_VERBOSE" ]; then
|
||||
NOTIFY_SEND=1
|
||||
fi
|
||||
|
||||
if [ -z "$NOTIFY_SEND" ] && [ ! -t 0 ] && [ -n "$DISPLAY" ] && command -v notify-send >/dev/null 2>&1; then
|
||||
NOTIFY_SEND=1
|
||||
fi
|
||||
|
||||
if [ "$NOTIFY_SEND" = 1 ]; then
|
||||
# if [ -z "$DISPLAY" ] || [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
# err "NOTIFY_SEND=1 set but no display available!"
|
||||
# fi
|
||||
if ! command -v notify-send >/dev/null 2>&1; then
|
||||
err "NOTIFY_SEND=1 set but notify-send unavailable!"
|
||||
fi
|
||||
fi
|
||||
|
||||
log_later() { LOG_LATER_ARGS=( "$@" ) ; }
|
||||
echo_msg() {
|
||||
local L
|
||||
local msg=""
|
||||
for L; do
|
||||
[ -n "$L" ] && msg+=" $L" || msg+="\n"
|
||||
done
|
||||
echo "$msg"
|
||||
}
|
||||
dsp() {
|
||||
local msg
|
||||
msg="$(echo_msg "$@")"
|
||||
echo -e "$msg"
|
||||
if [ -n "$NOTIFY_SEND_VERBOSE" ]; then
|
||||
notify-send "${BASH_SOURCE[0]}:" "$msg" || true
|
||||
fi
|
||||
}
|
||||
err() {
|
||||
local msg
|
||||
msg="$(echo_msg '' "$@" '')"
|
||||
echo -e "$msg" >&2
|
||||
if [ "${NOTIFY_SEND:-0}" = 1 ]; then
|
||||
notify-send "${BASH_SOURCE[0]}:" "$msg" || true
|
||||
fi
|
||||
}
|
||||
|
||||
## ======================================================================================
|
||||
## !!! please define or confirm the following three vars !!!
|
||||
## !!! before using the msmtpq or msmtp-queue scripts !!!
|
||||
## ======================================================================================
|
||||
##
|
||||
## it is now possible to put the needed variables into a config file
|
||||
|
||||
[ -f ~/.msmtpqrc ] && source ~/.msmtpqrc
|
||||
|
||||
## only if necessary (in unusual circumstances - e.g. embedded systems),
|
||||
## export the location of the msmtp executable before running this script (no quotes !!)
|
||||
## e.g. ( export MSMTP=/path/to/msmtp )
|
||||
MSMTP="${MSMTP:-msmtp}"
|
||||
"$MSMTP" --version >/dev/null 2>&1 || \
|
||||
log_later -e 1 "msmtpq : can't run the msmtp executable [ $MSMTP ]" # if not found - complain ; quit
|
||||
##
|
||||
## set the queue var to the location of the msmtp queue directory
|
||||
## if the queue dir doesn't yet exist, create it (0700)
|
||||
## before using this script
|
||||
## e.g. ( mkdir msmtp.queue )
|
||||
## ( chmod 0700 msmtp.queue )
|
||||
##
|
||||
## the queue dir - export this variable to reflect where you'd like it to be (no quotes !!)
|
||||
MSMTPQ_Q=${MSMTPQ_Q:-${Q:-"$HOME/.msmtp.queue"}}
|
||||
[ -d "$MSMTPQ_Q" ] || mkdir -m 0700 -p "$MSMTPQ_Q"
|
||||
if ! [ -d "$MSMTPQ_Q" ]; then
|
||||
err "msmtpq : can't create missing msmtp queue directory [ $MSMTPQ_Q ]"
|
||||
exit 1
|
||||
fi
|
||||
##
|
||||
## set the queue log file var to the location of the msmtp queue log file
|
||||
## where it is or where you'd like it to be
|
||||
## ( note that the MSMTPQ_LOG setting could be the same as the )
|
||||
## ( 'logfile' setting in .msmtprc - but there may be )
|
||||
## ( some advantage in keeping the two logs separate )
|
||||
## if you don't want the log at all set the var to an empty string
|
||||
## (doing so would be inadvisable under most conditions, however)
|
||||
##
|
||||
## the queue log file - export this variable to change where logs are stored (but no quotes !!)
|
||||
## Set it to "" (empty string) to disable logging.
|
||||
if [ -z ${MSMTPQ_LOG+x} ] ; then
|
||||
MSMTPQ_LOG="${LOG:-"$HOME/log/msmtp.queue.log"}"
|
||||
fi
|
||||
if [ -n "$MSMTPQ_LOG" ] ; then
|
||||
msmtpq_log_dir="$(dirname "$MSMTPQ_LOG")"
|
||||
[ -d "$msmtpq_log_dir" ] || mkdir -p "$msmtpq_log_dir"
|
||||
if ! [ -d "$msmtpq_log_dir" ]; then
|
||||
err "msmtpq : can't create missing msmtp queue log file directory [ $msmtpq_log_dir ]"
|
||||
exit 1
|
||||
fi
|
||||
unset msmtpq_log_dir
|
||||
fi
|
||||
|
||||
umask 077 # set secure permissions on created directories and files
|
||||
|
||||
declare -i CNT # a count of mail(s) currently in the queue
|
||||
declare -a Q_LST # queue list array ; used selecting a mail (to send or remove)
|
||||
|
||||
error_handler() {
|
||||
local summary="Error: In ${BASH_SOURCE[0]}, Lines $1 and $2, Command $3 exited with Status $4"
|
||||
local body=$(pr -tn "${BASH_SOURCE[0]}" | tail -n+$(($1 - 3)) | head -n7 | sed '4s/^\s*/>> /')
|
||||
echo >&2 -en "$summary\n$body" &&
|
||||
[ "$NOTIFY_SEND" = 1 ] && notify-send --urgency=critical "$summary" "$body"
|
||||
exit "$4"
|
||||
}
|
||||
trap 'error_handler $LINENO "$BASH_LINENO" "$BASH_COMMAND" $?' ERR
|
||||
|
||||
LKD= # lock flag
|
||||
trap on_exit INT TERM EXIT # run 'on_exit' on exit
|
||||
on_exit() { # unlock the queue on exit if the lock was set here
|
||||
if [ -n "$LKD" ]; then lock_queue -u 2>/dev/null; fi
|
||||
}
|
||||
|
||||
#
|
||||
## ----------------------------------- functions common to both modes
|
||||
## ----------------------------------- (msmtpq & msmtp-queue)
|
||||
#
|
||||
|
||||
## make an entry to the queue log file, possibly an error
|
||||
## (log queue changes only ; not interactive chatter)
|
||||
## usage : log [ -e errcode ] msg [ msg ... ]
|
||||
## opts : -e <exit code> an error ; log msg & terminate w/prejudice
|
||||
## display msg to user, as well
|
||||
##
|
||||
log() {
|
||||
local ARG RC PFX
|
||||
PFX="$('date' +'%Y %d %b %H:%M:%S')"
|
||||
# time stamp prefix - "2008 13 Mar 03:59:45 "
|
||||
if [ "$1" = '-e' ] ; then # there's an error exit code
|
||||
RC="$2" # take it
|
||||
shift 2 # shift opt & its arg off
|
||||
err "$@" # display msg to user, as well as logging it
|
||||
elif [ -z "$EMAIL_QUEUE_QUIET" ]; then
|
||||
dsp "$@" # display msg to user
|
||||
fi
|
||||
|
||||
if [ -n "$MSMTPQ_LOG" ] ; then # log is defined and in use
|
||||
for ARG ; do # each msg line out
|
||||
[ -n "$ARG" ] && \
|
||||
# line has content ; send it to log but avoid command injection
|
||||
printf "%s : %s\n" "$PFX" "$ARG" >> "$MSMTPQ_LOG"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$RC" ] ; then # an error ; leave w/error return
|
||||
[ -n "$LKD" ] && lock_queue -u # unlock here (if locked)
|
||||
[ -n "$MSMTPQ_LOG" ] && \
|
||||
echo " exit code = $RC" >> "$MSMTPQ_LOG" # logging ok ; send exit code to log
|
||||
exit "$RC" # exit w/return code
|
||||
fi
|
||||
}
|
||||
|
||||
## write/remove queue lockfile for a queue op
|
||||
##
|
||||
lock_queue() { # <-- '-u' to remove lockfile
|
||||
local LOK="${MSMTPQ_Q}/.lock" # lock file name
|
||||
local -i MAX=240 SEC=0 # max seconds to gain a lock ; seconds waiting
|
||||
|
||||
if [ -z "$1" ]; then # lock queue
|
||||
## Philipp Hartwig patch #2
|
||||
'mkdir' "$LOK" 2>/dev/null && LKD='t'
|
||||
while [ -z "$LKD" ] && [ "$SEC" -lt "$MAX" ]; do # lock file present
|
||||
sleep 1 # wait a second
|
||||
SEC=$((SEC + 1)) # accumulate seconds
|
||||
'mkdir' "$LOK" 2>/dev/null && LKD='t' # make lockdir ; lock queue ; set flag
|
||||
done # try again while locked for MAX secs
|
||||
if [ -z "$LKD" ]; then
|
||||
# lock file still there, give up
|
||||
err "cannot use queue $MSMTPQ_Q : waited $MAX seconds for"\
|
||||
" lockdir [ $LOK ] to vanish ; giving up"\
|
||||
'if you are certain that no other instance of this script'\
|
||||
" is running, then 'rmdir' the lock dir manually"
|
||||
exit 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
elif [ "$1" = '-u' ] ; then # unlock queue
|
||||
if [ -d "$LOK" ]; then 'rmdir' "$LOK"; fi # remove the lock
|
||||
if [ -n "$LKD" ]; then unset LKD; fi # unset flag
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
## test whether system is connected
|
||||
## returns t/f (0/1)
|
||||
##
|
||||
case $(uname | tr '[:upper:]' '[:lower:]') in
|
||||
darwin* | *bsd)
|
||||
PING_TIMEOUT_FLAG=t
|
||||
;;
|
||||
*)
|
||||
PING_TIMEOUT_FLAG=w
|
||||
;;
|
||||
esac
|
||||
connect_test() {
|
||||
if [ -z "$EMAIL_CONN_TEST" ] || [ "$EMAIL_CONN_TEST" = 'p' ] ; then
|
||||
# verify net connection - ping ip address of debian.org
|
||||
# would ping -qnc2 -w4 be better ?
|
||||
# would ping -qnc1 -w10 or -w20 be better ?
|
||||
#ping -qnc1 -w4 debian.org >/dev/null 2>&1 || return 1
|
||||
ping -qnc2 -${PING_TIMEOUT_FLAG}10 debian.org >/dev/null 2>&1 || return 1
|
||||
elif [ "$EMAIL_CONN_TEST" = 'P' ] ; then # use quicker ping test
|
||||
# I personally think that including a DNS lookup
|
||||
# is a better connection test but some
|
||||
# have found the above test too slow
|
||||
ping -qnc1 -${PING_TIMEOUT_FLAG}4 8.8.8.8 >/dev/null 2>&1 || return 1
|
||||
elif [ "$EMAIL_CONN_TEST" = 'n' ] ; then # use netcat (nc) test
|
||||
# must, of course, have netcat (nc) installed
|
||||
command -v nc >/dev/null 2>&1 || \
|
||||
log -e 1 "msmtpq : can't find netcat executable [ nc ]"
|
||||
'nc' -vz -w 5 www.debian.org 80 >/dev/null 2>&1 || return 1
|
||||
elif [ "$EMAIL_CONN_TEST" = 's' ] ; then # use sh sockets test
|
||||
# note that this does not work on debian systems
|
||||
# where bash opened sockets are suppressed for security
|
||||
# reasons on multiuser systems - however, this should be
|
||||
# ok for single user systems (including embedded systems)
|
||||
# test whether this is supported on your system before using...
|
||||
# thank you to Brian Goose, on the list, for encouraging this
|
||||
exec 3<>/dev/udp/debian.org/80 || return 1 # open socket on site ; use dns
|
||||
exec 3<&- ; exec 3>&- # close socket
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
## ----------------------------------- functions for queue management
|
||||
## ----------------------------------- queue maintenance mode - (msmtp-queue)
|
||||
#
|
||||
|
||||
## show queue maintenance functions
|
||||
##
|
||||
usage() { # <-- error msg
|
||||
dsp ''\
|
||||
'usage : msmtp-queue functions' ''\
|
||||
' msmtp-queue < op >'\
|
||||
' ops : -r run (flush) mail queue - all mail in queue'\
|
||||
' -R send selected individual mail(s) in queue'\
|
||||
' -d display (list) queue contents (<-- default)'\
|
||||
' -p purge individual mail(s) from queue'\
|
||||
' -a purge all mail in queue'\
|
||||
' -h this helpful blurt' ''\
|
||||
' ( one op only ; any others ignored )' ''
|
||||
if [ -z "$1" ]; then
|
||||
exit 0;
|
||||
else
|
||||
dsp "$@" '';
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
## get user [y/n] acknowledgement
|
||||
##
|
||||
ok() {
|
||||
local R YN='Y/n' # default to yes
|
||||
|
||||
[ "$1" = '-n' ] && \
|
||||
{ YN='y/N' ; shift ; } # default to no ; change prompt ; shift off spec
|
||||
|
||||
dsp "$@"
|
||||
while true ; do
|
||||
echo -n " ok [${YN}] ..: "
|
||||
read -r R
|
||||
case $R in
|
||||
y|Y) return 0 ;;
|
||||
n|N) return 1 ;;
|
||||
'') [ "$YN" = 'Y/n' ] && return 0 || return 1 ;;
|
||||
*) echo 'yYnN<cr> only please' ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
## send a queued mail out via msmtp
|
||||
##
|
||||
send_queued_mail() { # <-- mail id
|
||||
local FQP="${MSMTPQ_Q}/${1}" # fully qualified path name
|
||||
local -i RC=0 # for msmtp exit code
|
||||
|
||||
if [ -f "${FQP}.msmtp" ] ; then # corresponding .msmtp file found
|
||||
[ "$EMAIL_CONN_TEST" != 'x' ] && \
|
||||
[ -z "$EMAIL_CONN_NOTEST" ] && { # do connection test
|
||||
connect_test || {
|
||||
log "mail [ $2 ] [ $1 ] from queue ; couldn't be sent - host not connected"
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
if "$MSMTP" $(< "${FQP}.msmtp") < "${FQP}.mail" ; then # this mail goes out the door
|
||||
log "mail [ $2 ] [ $1 ] from queue ; send was successful ; purged from queue" # good news to user
|
||||
'rm' -f "${FQP}".* # nuke both queue mail files
|
||||
ALT='t' # set queue changed flag
|
||||
else # send was unsuccessful
|
||||
RC=$? # take msmtp exit code
|
||||
log "mail [ $2 ] [ $1 ] from queue ; send failed ; msmtp rc = $RC" # bad news ...
|
||||
fi
|
||||
return $RC # func returns exit code
|
||||
else # corresponding MSF file not found
|
||||
log "preparing to send .mail file [ $1 ] [ ${FQP}.mail ] but"\
|
||||
" corresponding .msmtp file [ ${FQP}.msmtp ] was not found in queue"\
|
||||
' skipping this mail ; this is worth looking into' # give user the bad news
|
||||
fi # (but allow continuation)
|
||||
}
|
||||
|
||||
is_queue_dir_empty() {
|
||||
# - "shopt -p" is available as of bash 2.01.1
|
||||
# - "trap ... RETURN" is available as of bash 2.05b
|
||||
# - the return value of shopt must be ignored (the manual says:
|
||||
# "The return status when listing options is zero if all
|
||||
# optnames are enabled, non-zero otherwise.")
|
||||
trap '$(shopt -p nullglob || true)' RETURN
|
||||
shopt -s nullglob
|
||||
local files=( "$MSMTPQ_Q"/*.mail )
|
||||
(( ${#files[@]} == 0 ))
|
||||
}
|
||||
|
||||
## run (flush) queue
|
||||
##
|
||||
run_queue() { # <- 'sm' mode # run queue
|
||||
if is_queue_dir_empty ; then
|
||||
[ -n "$1" ] || dsp '' 'mail queue is empty (nothing to send)' ''
|
||||
return
|
||||
fi
|
||||
|
||||
local M
|
||||
local -i NDX=0
|
||||
|
||||
for M in "$MSMTPQ_Q"/*.mail ; do # process all mails
|
||||
NDX=$((NDX + 1))
|
||||
send_queued_mail "$(basename "$M" .mail)" "$NDX" # send mail - pass {id} only
|
||||
done
|
||||
if [ "$NDX" = 0 ] && [ -z "$1" ]; then # queue is empty. inform user (if not running in sendmail mode)
|
||||
dsp '' 'mail queue is empty (nothing to send)' ''
|
||||
fi
|
||||
}
|
||||
|
||||
## display queue contents
|
||||
##
|
||||
display_queue() { # <-- { 'purge' | 'send' } (op label) ; { 'rec' } (record array of mail ids)
|
||||
if is_queue_dir_empty ; then
|
||||
if [ -z "$1" ]; then
|
||||
dsp '' 'no mail in queue' ''
|
||||
else
|
||||
dsp '' "mail queue is empty (nothing to $1)" '' # inform user
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
local M ID
|
||||
|
||||
for M in "$MSMTPQ_Q"/*.mail ; do # cycle through each
|
||||
ID="$(basename "$M" .mail)" # take mail id from filename
|
||||
CNT="$((CNT + 1))"
|
||||
dsp '' "mail num=[ $CNT ] id=[ $ID ]" # show mail id ## patch in
|
||||
'grep' -E -s -h -m 3 '(^From:|^To:|^Subject:)' "$M" || true
|
||||
[ -n "$2" ] && Q_LST["$CNT"]="$ID" # bang mail id into array (note 1-based array indexing)
|
||||
done
|
||||
echo
|
||||
if [ "$CNT" = 0 ]; then # no mails ; no contents
|
||||
if [ -z "$1" ]; then
|
||||
dsp '' 'no mail in queue' ''
|
||||
else
|
||||
dsp '' "mail queue is empty (nothing to $1)" '' # inform user
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
## delete all mail in queue, after confirmation
|
||||
##
|
||||
purge_queue() {
|
||||
display_queue 'purge' # show queue contents
|
||||
if ok -n 'remove (purge) all mail from the queue' ; then
|
||||
lock_queue # lock here
|
||||
'rm' -f "$MSMTPQ_Q"/*.*
|
||||
log 'msmtp queue purged (all mail)'
|
||||
lock_queue -u # unlock here
|
||||
else
|
||||
dsp '' 'nothing done ; queue is untouched' ''
|
||||
fi
|
||||
}
|
||||
|
||||
## select a single mail from queue ; delete it or send it
|
||||
## select by mail index (position in queue) or mail id
|
||||
##
|
||||
select_mail() { # <-- < 'purge' | 'send' >
|
||||
local ID # mail id
|
||||
local -i NDX
|
||||
|
||||
while true ; do # purge an individual mail from queue
|
||||
display_queue "$1" 'rec' # show queue contents ; make mail ids array
|
||||
|
||||
## allow selection also by mail index
|
||||
if [ $CNT -eq 1 ] ; then # only one mail in queue ; take its id
|
||||
NDX=1
|
||||
ID="${Q_LST[1]}"
|
||||
else # more than one mail ; select its id
|
||||
while true ; do # get mail id
|
||||
dsp "enter mail number or id to $1" # <-- num or file name (only, no suff)
|
||||
echo -n ' ( <cr> alone to exit ) ..: '
|
||||
read -r ID
|
||||
[ -n "$ID" ] || return
|
||||
|
||||
if [[ ${ID:4:1} != '-' && ! $ID =~ ^[0-9]+$ ]]; then
|
||||
NDX=$ID
|
||||
if [ "$NDX" -lt 1 ] || [ "$NDX" -gt "$CNT" ] ; then # test number range (1 - $CNT)
|
||||
dsp '' "[ $NDX ] is out of range as a mail number"\
|
||||
"validity is from 1 to $CNT"
|
||||
continue # try again
|
||||
fi
|
||||
|
||||
ID="${Q_LST[$NDX]}" # format & range were ok ; use it
|
||||
break # valid mail selection
|
||||
else # mail id entered
|
||||
NDX=1
|
||||
while [ "$NDX" -le ${#Q_LST[*]} ]; do # find entered id in queue list
|
||||
[ "$ID" = "${Q_LST[$NDX]}" ] && break
|
||||
NDX=$((NDX + 1))
|
||||
done
|
||||
if [ "$NDX" -le ${#Q_LST[*]} ]; then
|
||||
break
|
||||
else
|
||||
dsp '' "mail [ $ID ] not found ; invalid id" # mail selection valid (found) or
|
||||
fi
|
||||
fi # fell through (not found) complain
|
||||
done # and ask again
|
||||
fi
|
||||
|
||||
if ok '' "$1 :"\
|
||||
" mail num=[ $NDX ]"\
|
||||
" id=[ $ID ]" '' ; then # confirm mail op
|
||||
if [ "$1" = 'purge' ] ; then # purging
|
||||
lock_queue # lock here
|
||||
'rm' -f "$MSMTPQ_Q"/"$ID".* # msmtp - nukes single mail (both files) in queue
|
||||
log "mail [ $ID ] purged from queue" # log op
|
||||
lock_queue -u # unlock here
|
||||
ALT='t' # mark that a queue alteration has taken place
|
||||
else # sending
|
||||
lock_queue # lock here
|
||||
send_queued_mail "$ID" "$NDX" # send out the mail
|
||||
lock_queue -u # unlock here
|
||||
fi
|
||||
else # user opts out
|
||||
dsp '' 'nothing done to this queued email' # soothe user
|
||||
[ $CNT -eq 1 ] && break # single mail ; user opted out
|
||||
fi
|
||||
dsp '' "--------------------------------------------------"
|
||||
done
|
||||
|
||||
if [ -n "$ALT" ] ; then # queue was changed
|
||||
dsp '' 'done' ''
|
||||
else # queue is untouched
|
||||
dsp '' 'nothing done ; queue is untouched' ''
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
## ----------------------------------- functions for directly sending mail
|
||||
## ----------------------------------- 'sendmail' mode - (msmtpq)
|
||||
#
|
||||
|
||||
## ('sendmail' mode only)
|
||||
## make base filename id for queue
|
||||
##
|
||||
make_id() {
|
||||
local -i INC # increment counter for (possible) base fqp name collision
|
||||
|
||||
ID="$(date +%Y-%m-%d-%H.%M.%S)" # make filename id for queue (global
|
||||
FQP="${MSMTPQ_Q}/$ID" # make fully qualified pathname vars)
|
||||
## Philipp Hartwig patch #1
|
||||
if [ -f "${FQP}.mail" ] || [ -f "${FQP}.msmtp" ] ; then # ensure fqp name is unique
|
||||
INC=1 # initial increment
|
||||
while [ -f "${FQP}-${INC}.mail" ] || [ -f "${FQP}-${INC}.msmtp" ] ; do # fqp name w/incr exists
|
||||
INC=$((INC + 1)) # bump increment
|
||||
done
|
||||
ID="${ID}-${INC}" # unique ; set id
|
||||
FQP="${FQP}-${INC}" # unique ; set fqp name
|
||||
fi
|
||||
}
|
||||
|
||||
## ('sendmail' mode only)
|
||||
## enqueue a mail
|
||||
##
|
||||
enqueue_mail() { # <-- all mail args ; mail text via TMP
|
||||
if echo "$@" > "${FQP}.msmtp" ; then # write msmtp command line to queue .msmtp file
|
||||
log "enqueued mail as : [ $ID ] ( $* )" # (queue .mail file is already there)
|
||||
else # write failed ; bomb
|
||||
log -e "$?" "queueing - writing msmtp cmd line { $* }"\
|
||||
" to [ ${ID}.msmtp ] : failed"
|
||||
fi
|
||||
}
|
||||
|
||||
## ('sendmail' mode only)
|
||||
## send a mail (if possible, otherwise enqueue it)
|
||||
## if send is successful, msmtp will also log it (if logging enabled in ~/.msmtprc)
|
||||
##
|
||||
send_mail() { # <-- all mail args ; mail text via TMP
|
||||
[ "$EMAIL_CONN_TEST" != 'x' ] && \
|
||||
[ -z "$EMAIL_CONN_NOTEST" ] && { # do connection test
|
||||
connect_test || {
|
||||
log "mail for [ $* ] : sending FAILED as host disconnected."
|
||||
enqueue_mail "$@" # enqueue the mail
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if "$MSMTP" "$@" < "${FQP}.mail" > /dev/null ; then # send mail using queue .mail fil
|
||||
log "mail for [ $* ] : sent successfully" # log it
|
||||
'rm' -f "${FQP}".* # remove all queue mail files .mail & .msmtp file
|
||||
run_queue 'sm' # run/flush any other mails in queue
|
||||
else # send failed - the mail stays in the queue
|
||||
log "mail for [ $* ] : sending FAILED as msmtp exited with $?"\
|
||||
"enqueued mail as : [ $ID ] ( $* )" # (queue .mail file is already there)
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
## -- entry point
|
||||
#
|
||||
|
||||
[ -z "${LOG_LATER_ARGS+x}" ] || log "${LOG_LATER_ARGS[@]}"
|
||||
if [ ! "$1" = '--q-mgmt' ] ; then # msmtpq - sendmail mode
|
||||
lock_queue # lock here
|
||||
make_id # make base queue filename id for this mail
|
||||
# write mail body text to queue .mail file
|
||||
cat > "${FQP}.mail" || \
|
||||
log -e "$?" "creating mail body file [ ${FQP}.mail ] : failed" # test for error
|
||||
# write msmtp command line to queue .msmtp file
|
||||
echo "$@" > "${FQP}.msmtp" || \
|
||||
log -e "$?" "creating msmtp cmd line file { $* }"\
|
||||
" to [ ${ID}.msmtp ] : failed" # test for error
|
||||
send_mail "$@" # send the mail if possible, queue it if not
|
||||
lock_queue -u # unlock here
|
||||
else # msmtp-queue - queue management mode
|
||||
shift # trim off first (--q-mgmt) arg
|
||||
OP=${1:1} # trim off first char of OP arg
|
||||
case "$OP" in # sort ops ; run according to spec
|
||||
r) lock_queue
|
||||
run_queue
|
||||
lock_queue -u ;; # run (flush) the queue
|
||||
R) select_mail send ;; # send individual mail(s) in queue
|
||||
d|'') display_queue ;; # display (list) all mail in queue (default)
|
||||
p) select_mail purge ;; # purge individual mail(s) from queue
|
||||
a) purge_queue ;; # purge all mail in queue
|
||||
h) usage ;; # show help
|
||||
*) usage "[ -$OP ] is an unknown msmtp-queue option" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user