# -*- mode: muttrc -*-
# ====================[ muttrc.local.sdf                   ]====================
# SDF-specific identity and mailboxes; see "http://sdf.freeshell.org".

# ....................{ IDENTITY                           }....................
# Switch the "From: " header, according to which contact we're sending to and
# which mailbox we're sending from. (When sending mail to a Yahoo! Group, for
# example, we say we're sending mail from our Yahoo! Group e-mail address.
# Why? The Yahoo! Groups e-mail server rejects mail addressed from non-Yahoo!
# Group e-mail addresses.)
                            my_hdr From: "B.w.Curry" <bcurry@freeshell.org>
send-hook "~t yahoogroups" 'my_hdr From: "B.w.Curry" <curadiaeth@yahoo.com>'

# Save a copy of sent mail by bouncing it to ourselves. 
# ~~~~~~~~~~~~~~~~
# By bouncing it--in indirect fashion--rather than the more explicit setting
# of $record to save outgoing mail into one static mailbox, we allow our MDA
# to electively save all such mail into some other mailboxes, as it sees fit.
#
# For example, my MDA [procmail + Mail::Audit] returns outgoing mail back to
# the mailbox, to which I first recieved the original, incoming mail. In so
# doing, I do demand that Mutt thread my outgoing with incoming mail; and, 
# so done, do create cohesive threads of kinder, fuller conversation.
my_hdr Bcc: "B.w.Curry" <bcurry@freeshell.org>

# ....................{ PATHS                              }....................
# Set the $folder + and = expansions relative to...
# ~~~~~~~~~~~~~~~~
# We do not append this path with an explicit '/' character. When we do, mutt
# prepends all mailboxes with an explicit path string; otherwise, mutt simply
# prepends all mailboxes with the '=' character. (Odd. We thought so too.)
set folder=~/var/mail/sdf  # [PATH] your local Maildir root
set spoolfile=no           # [PATH] retrieve new mail from a spool-file?

# ....................{ MAILBOXES                          }....................
# If $copy is set, then...
set record=+.sent          # [PATH] save a copy of sent mail here

# If $postpone is set, then...
set postponed=+.sent.not   # [PATH] store postponed mail here

# If $move is set, then...
set mbox=+.read            # [PATH] move read messages here

source ~/.mutt/muttrc.localhost.sdf.mailboxes

# ....................{ MAIL SENDING                       }....................
# Send mail via "nbsmtp," the no-brainer SMTP client.
set sendmail="/usr/bin/nbsmtp -h smtp.xnet.co.nz -d xnet.co.nz -f bcurry@freeshell.org"

# Automagically detect all mailboxes - all path-names starting with a '.'
# ~~~~~~~~~~~~~~~~
# We produce an auto-magic line, resembling:
#   "mailboxes +.beam.corps +.beam.nihon +.list.salviad_alliance"
#mailboxes ` \
#  for file in ~/mail/.*; do \
#    box=$(basename "$file"); \
#    if [ \
#       ! "$box" = '.' \
#    -a ! "$box" = '..' \
#    -a ! "$box" = '.customflags' \
#    -a ! "$box" = '.subscriptions' \
#    ]; then \
#      echo -n "+$box "; \
#    fi; \
#  done; \
#`
#
# Alternative method, conceivably more ideal.
# mailboxes \
#   +hp/INBOX \
#   +g1/INBOX \
#   +g2/INBOX \
#   `cd ~/mail; find hp g1 g2 -type d -maxdepth 1 -mindepth 1 \
#    ! -name INBOX ! -name Outbox ! -name Trash ! -name postponed ! -name sent \
#    -printf "+%p "`
 
# Automagically detect all list mailboxes, which start in a '.wave'
# ~~~~~~~~~~~~~~~~
# We produce an auto-magic line, resembling:
#   "subscribe salviad_alliance the_nagual the_shroomery"
#subscribe `\
#   perl -e \
#'for (<~/mail/.wave.*>) { $_ =~ s~^.*\.wave\.~~; print $_ . " "; } print "\n"' \
#`
