Fsdb::F...ormmail(3)

πŸ“¦
version 3.9 Β· 3 versions
, in epel 9

Okay bestie, welcome to the Fsdb::F...ormmail(3) page β€” yes, the User Contributed Perl Documentation one, aka dbformmail. Buckle up, it’s giving β€œwrite a mail script, but make it safe” energy πŸ’Œ

πŸ’– NAME πŸ’–

dbformmail β€” write a shell script that will send e-mail to many people ✨

✨ SYNOPSIS ✨

dbformmail [-m MECHANISM] format_file.txt

🌸 DESCRIPTION 🌸

Okay so here’s the tea β˜•: dbformmail reads a β€œform mail” message from the file FORMAT_FILE.TXT, and it fills in underscore-preceded column-names with data. Then it outputs a shell script that will send each message through some mail transport MECHANISM. That’s the whole vibe.

Do not use this program for evil or I will have to come over and have words with you. No cap, that’s literally in the manual 😭

Important bestie note: this program does NOT actually SEND the mail. It writes a shell script that will send the mail for you. I recommend you save it to a file, check it (one last time!), then run it with sh.

Also, unlike most Fsdb programs, this program does not output a FSDB file. It’s not that kind of party 🫢

πŸ’… OPTIONS πŸ’…

Okay, options time. Grab your lil’ checklist πŸŽ€

  • -m MECHANISM β€” pick the mail-sending mechanism: Mail, sendmail, or mh. Defaults to "Mail".
    • Mail uses a Berkeley-style /usr/bin/Mail.
    • sendmail invokes /usr/bin/sendmail.
    • mh writes messages into the current directory, treating it as an mh-style mailbox (one message per file, with filesnames as sequential integrates).

This module also supports the standard fsdb options:

  • -d β€” enable debugging output.
  • -i or --input InputSource β€” read from InputSource, typically a file name, or - for standard input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • -o or --output OutputDestination β€” write to OutputDestination, typically a file name, or - for standard output, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • --autorun or --noautorun β€” by default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The --(no)autorun option controls that behavior within Perl.
  • --help β€” show help.
  • --man β€” show full manual.

πŸŽ€ SAMPLE USAGE πŸŽ€

πŸ“₯ Input:

#fsdb account passwd uid gid fullname homedir shell
johnh * 2274 134 John_Heidemann /home/johnh /bin/bash
greg * 2275 134 Greg_Johnson /home/greg /bin/bash
root * 0 0 Root /root /bin/bash
# this is a simple database

πŸ’Œ Sample form (in the file form.txt):

To: _account
From: the sysadmin <root>
Subject: time to change your password

Please change your password regularly.
Doesn't this message make you feel safer?

🎬 Command:

cat DATA/passwd.fsdb | dbformmail form.txt >outgoing.sh

πŸ“€ Output (in outgoing.sh):

#!/bin/sh
sendmail 'johnh' <<'END'
To: johnh
From: the sysadmin <root>
Subject: time to change your password

Please change your password regularly.
Doesn't this message make you feel safer?

END
sendmail 'greg' <<'END'
(etc.)

And to send the mail, run

sh outgoing.sh

πŸ¦‹ SEE ALSO πŸ¦‹

Fsdb β€” that’s the one. Go give it a look πŸ‘€

πŸ‘‘ CLASS FUNCTIONS πŸ‘‘

Under the hood, bestie. These are the Perl bits 🧚

🌟 new 🌟

$filter = new Fsdb::Filter::dbformmail(@arguments);

Makes a fresh dbformmail object, taking command-line arguments.

🌟 set_defaults 🌟

$filter->set_defaults();

Internal: set up defaults β€” behind-the-scenes glow-up.

🌟 parse_options 🌟

$filter->parse_options(@ARGV);

Internal: parse command-line arguments.

🌟 setup 🌟

$filter->setup();

Internal: setup, parse headers.

🌟 run 🌟

$filter->run();

Internal: run over each rows.

🌟 finish 🌟

$filter->finish();

Internal: write trailer, but no trailer for us.

Copyright (C) 1991-2018 by John Heidemann <johnh@isi.edu>

This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details.


This iconic page is Fsdb::F...ormmail(3), from perl v5.32.1, dated 2024-08-02. Bye bestie, go check that script one last time! πŸ’…βœ¨

πŸ“¦ where this page comes from