EXTSMAIL.EXTERNALS(5)

πŸ’– EXTSMAIL.EXTERNALS πŸ’–

okay so this is the extsmail.externals page, from the File Formats Manual section β€” it's a file formats situation, manual 5, iykyk. sit down bestie, we're configuring which external commands send your mail, robustly. ✨


✨ NAME ✨

extsmail.externals β€” the config file where you tell things which external commands to robustly send e-mail via πŸ¦‹


🌸 DESCRIPTION 🌸

So extsmail.externals is literally the file that configures extsmaild(1). πŸ’… It's made up of one or more group declarations. Each group is zero or more match / reject clauses, and then one or more external declarations. And an external is just one or more assignments of key = value pairs. that's it, that's the whole structure. πŸŽ€

When it's actually sending messages, extsmaild(1) does this: first it searches through the externals file, in order, looking for a group whose match / reject clauses match the message in question. πŸ‘€ If a group doesn't have any of those clauses, it just automatically matches all messages β€” no cap, it's a yes-man. Match / reject clauses currently only match against headers, and they use standard POSiX extended regular expressions (peep re_format(7) for the deets). Then extsmaild(1) tries each external in the group, in order, to send the message successfully. slay. πŸ’…

The grammar for this file is, fr fr, exactly this:

group    ::= { matches* external+ }

matches  ::= match
           | reject
match    ::= MATCH HEADER string
reject   ::= REJECT HEADER string

external ::= EXTERNAL ID { defn+ }

defn     ::= ID = STRING
           | ID = TIME

TIME     ::= [0-9]+[dhms]

Valid assignments within an external are these two cuties πŸ‘‘:

  • sendmail β€” defines the external shell command used to send e-mail. that's the one doing the actual work, main character energy fr.
  • timeout β€” if extsmaild(1) is running in daemon mode, this value sets the length of time extsmaild(1) will retry this external before giving up and trying the next external in the group. 😭 Times are written as a number followed by d (days), h (hours), m (minutes), or s (seconds). But heads up bestie β€” if extsmaild(1) is running in batch mode, the timeout value is ignored. periodt.

πŸŽ€ FILES πŸŽ€

The extsmail configuration file is searched for, in order, in these locations:

  • ~/.extsmail/externals β€” per-user configuration. 🫢 this one's yours, yours, yours.
  • /etc/extsmail/externals β€” system-wide configuration. πŸ‘‘

🌈 EXAMPLES 🌈

The simplest externals file sending e-mail via ssh(1) looks like this, and honestly? iconic for how little it does:

group {
    external mymachine {
        sendmail = "/usr/bin/ssh -q -C -l user mymachine.net /usr/sbin/sendmail -t"
    }
}

where mymachine is a human-friendly name given to an external (it does not effect processing β€” it's purely a vibe, a nickname, a little label πŸ’…), and user is the username on the remote machine mymachine.net. πŸ¦‹

A more complex example using multiple groups, message matching, and multiple external commands looks like this:

group {
    match header "^To:.*@foo.com"

    external foo {
        sendmail = "/usr/bin/ssh -q -C -l user shell.foo.com /usr/sbin/sendmail -t"
    }
}

group {
    external mymachine {
        sendmail = "/usr/bin/ssh -q -C -l user mymachine.net /usr/sbin/sendmail -t"
    }

    external bk {
        sendmail = "/usr/bin/ssh -q -C -l user bk.mymachine.net /usr/sbin/sendmail -t"
    }
}

see how the first group is picky and the second one is like "sure whatever, try both"? that's the energy. ✨


πŸ‘€ SEE ALSO πŸ‘€

extsmail(1), extsmail.conf(5), extsmaild(1)

go read those too bestie, they're the whole friend group 🫢


πŸ’œ AUTHORS πŸ’œ

Laurence Tratt <http://tratt.net/laurie/> β€” thank you for your service, legend πŸ‘‘


and that's the whole page!! this one shipped as part of Debian, dated November 2, 2008 β€” yes, 2008, it's vintage, it's retro, it's still slaying πŸ’…βœ¨ mwah, go send some mail πŸ“πŸ’–

πŸ“¦ where this page comes from