YAMPLE(1)
π YAMPLE(1) π
ok bestie, gather round, because we are reading the manual page for YAMPLE(1) β User Contributed Perl Documentation β and it's lowkey a whole masterpiece. Let's go. π¦
β¨ NAME β¨
Yample β Yet Another Mail Processing Language. π
πΈ DESCRIPTION πΈ
Okay so picture this: Yample is an MDA β a mail delivery agent. It accepts a message via standard input and stores this message in a maildir or in an mbox. That's the whole job. She sorts, she files, she moves on. π
Yample tries to incorporate the power of Perl and Mail::Internet, Mail::Spamassassin and the other Mail modules whilst maintaining an friendly syntax. (yes, "an friendly" β that's the original's words and I refuse to change a single character, it's iconic π)
And why does Yample exist, you ask? Because of a personal conflict with Procmails syntax. Real. The author simply said "not today" and built an entire language. Main character energy fr fr. π₯
Look at the following lines, taken from man procmailex:
:0 c * ^From.*peter * ^Subject:.*compilers ! william@somewhere.edu
:0 A
petcompil
This can be implemented like this in Yample:
sender(peter) and subject(compilers) unseen
resend(william@somewhere.edu) sender(peter) and subject(compilers)
mbox(petcompil)
See how much nicer that reads?? We ate. π
β¨ OPTIONS β¨
--helpβ Help! (she's a woman of few words and I respect it)--mailbase <maildir>β This option is prepended to any destinations you have. Default is~/Maildir/.--logfileβ Yamples logfile. Default is~/.yample/log.--loglevel <0-4>β Loglevel.4β Debug,3β info,2β warnings,1β errors,0β nothing. (0 is the silent-treatment era π)--spamassassinβ LoadMail::Spamassassinand run the mail through it.--spamcβ Run the message throughspamc. Yample will look forspamcin the$PATHunless you set--spamc-path.--spamc-path /path/to/spamcβ Wherespamcresides.--dubdb <file>β The message id database β used for duplicate suppression.--rules <file>β The rule file.
π FILES π
ποΈ ~/.yample/rules
This file contains the rules which Yample uses to sort mail. Yample reads the mail from STDIN and then processes the rules, one by one. So polite. So orderly. So organized. π«Ά
The rules consists of two parts; condition(s) and target. There is an implicit if .. then .. else between every rule. Please see the examples futher down. (keeping "futher", it's part of the lore π)
In the conditions which take a regular expression as a parameter you can use grouping to extract parts of the text and utilize this in the sorting. Like this:
subject((.*)) and rcpt(user@foo.org): reject(Your message with subject $1 was rejected)
Cool, eh? π
NOTE: We replace/and.with_in grouped strings to make sure there won't be any funny business.
π§ Yample::Rules
This package contains subroutines which handle the individual rules. The rules are transformed into perl code which will call these methods to decide what to do with the message.
dup()β Detects duplicates.rcpt()β The rcpt rule matches against theTo- andCc-headers.sender()β The sender rule matches against theFrom-header.subject()β Matches on the subject of the message.list()β If Yample can loadMail::Listdetectthenlist()can be used to match against the name of the mailing list (unless the mailing list server is completely lame).
You can use this rule like this:
list((.*)): maildir(.lists.$1)
head()β Match against a arbitrary header. Note the caret (^)
head(^X-Spam-Flag: YES): maildir(.junk.spam)
head(^X-Infected:): maildir(.junk.virii)
spam()β If Yample loads Spamassassin (and runs the message through it) you can usespam()to determine the status of the message.perl()β Run arbitrary perl code. Unless you are some sort of pervert you would not use this for anything but testing and debugging Yample. π (the author's words, not mine, I'm just the messenger)
π Yample::Actions
Action dispatcher class. All the targets are defined here.
maildir()β Stores the message in a UW-style maildir more or less as defined per RFCXXXX.mbox()β Delivers mail to a standard Unix mailbox.
Parameters: The mailbox where the message is to be delivered.
resend()β Parameters: Where the message is to be forwarded.reject()β Reject the message. This normally forces your mail server to create a bounce and mail this to the original sender.
Parameters: Error message. This message will probably be included in the bounce generated.
ignore()β Ignore the message silently.
Parameters: none
reply()β Reply to the message.
Parameters: The body of the reply.
pipe()β Parameters: The command which is message is to be piped into. Executed through/bin/sh -c.
ποΈ ~/.yample/dupdb
Yamples database of message IDs. Yample uses this to supress dupicate messages (see dup() rules).
π ~/.yample/log
Your own personal logfile. You might want to use logrotate or similar programs to make sure it does not grow to big.
π¬ ~/.forward
Usually, your mail server looks for a file in your home directory called .forward. This file contains information how your mail server should deliver your mail. If you want Yample as your MDA your .forward should look like this: |/full/path/to/yample
π EXAMPLES π
# throw away virii
head(^X-Infected:): ignore()
# throw away spam with a score higher than 8
head(^X-Spam-Score: \d+\.\d+ \(\+{8,}\)
# The rest of the spam, tagged by spamassassin
head(^X-Spam-Flag: YES): maildir(.junk.spam)
dup(): maildir(.junk.duplicates)
# auto-sort lists - requires Mail::Listdetect
list((.*)): maildir(.lists.$1)
sender(@fjase.net) and subject(Backup report): maildir(.backup_reports)
# catch-all
perl(1): maildir()
That catch-all at the bottom?? Chef's kiss. Every message finds a home. π β¨
π VERSION π
Yample 0.30
π AUTHOR π
Per Andreas Buer <perbu (at) linpro.no>
π¦ PREREQUSITES π¦
Yamples needs the following perl modules. Please download from CPAN, Yamples home page or other sources.
Mail::Internet Mail::Send Text::Balanced
Yample also uses these modules - but they are in the Perl distribution so they should always be there.
Pod::Usage POSIX Sys::Hostname IO::File IPC::Open2
π BUGS π
Yample with Spamassassin, Mail::ListDetector and the other bells and whistles is quite heavy.
Please report bugs and functionality requests to the author.
Yample lacks (as of now) LMTP and IMAP support. Both should be fairly easy to implement.
β COPYRIGHT β
Copyright (C) 2003 Per Andreas Buer
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (read that twice, bestie β NO warranty, none, zero, nada π« )
π SEE ALSO π
Mail::Internet (3), Mail::SpamAssassin (3), Mail::ListDetector (3).
aaaand that's the whole page!! this beauty shipped as perl v5.8.2 on 2004-01-13, and honestly? she's still that girl. go sort some mail, you've got this. πβ¨π
π¦ where this page comes from
- debian trixie: yample 0.30-6 Β· GPL-2.0-only
- ubuntu jammy: yample 0.30-3.1
- ubuntu noble: yample 0.30-5
- ubuntu questing: yample 0.30-6
- ubuntu resolute: yample 0.30-6build1 Β· GPL-2.0-only
- ubuntu stonking: yample 0.30-6build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms