Mail::...Config(3pm)
π Mail::...Config(3pm) β the group chat version π
okay so bestie, you found the manual page for Mail::MtPolicyd::Plugin::SqlUserConfig, and ngl it's a lil gem. It's a User Contributed Perl Documentation page, and we're about to make it make sense together. grab a snack, we're doing this π
β¨ NAME β¨
Mail::MtPolicyd::Plugin::SqlUserConfig β an mtpolicyd plugin for retrieving the user config of a user π«Ά
πΈ VERSION πΈ
version 2.05
π¦ DESCRIPTION π¦
So what does this little icon actually do? This plugin goes and retrieves a JSON string from an SQL database, and then it merges that data structure into the current session. Periodt. π«
And like, why would you want that? Because you could use it to retrieve configuration values for users straight from a database. user-specific config, served fresh, no cap π
π PARAMETERS π
sql_query(default:SELECT config FROM user_config WHERE address=?) β this is the SQL query that retrieves the JSON configuration string. Heads up: the content of the first row/column is what gets used. only the first one, bestie, don't come for me about the rest πfield(default:recipient) β the request field used in the sql query to retrieve the user configuration. that's the vibe check for "whose config are we even talking about" π
π EXAMPLE USER SPECIFIC GREYLISTING π
okay this is the part where it gets good. first things first: create the following table in the SQL database π
CREATE TABLE `user_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`address` varchar(255) DEFAULT NULL,
`config` TEXT NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `address` (`address`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO TABLE `user_config` VALUES( NULL, 'karlson@vomdach.de', '{"greylisting":"on"}' );
(yes, INSERT INTO TABLE β that's literally what the page says, I'm not touching it, copying commands exactly is the whole assignment π)
then, in mtpolicyd.conf:
db_dsn="dbi:mysql:mail"
db_user=mail
db_password=password
<Plugin user-config>
module = "SqlUserConfig"
sql_query = "SELECT config FROM user_config WHERE address=?"
</Plugin>
<Plugin greylist>
enabled = "off" # off by default
uc_enabled = "greylisting" # override with value of key 'greylisting' is set in session
module = "Greylist"
score = -5
mode = "passive"
</Plugin>
and that's the whole glow-up. the greylist plugin is off by default, and uc_enabled = "greylisting" means it gets overridden with the value of the key greylisting is set in session. iconic setup, honestly π
π AUTHOR π
Markus Benning <ich@markusbenning.de> β the main character who wrote this π«‘
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>. give credit where credit is due, always π
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991
π reminder bestie: this page is fromperl v5.38.2, dated2024-05-26, and it's filed underMail::...Config(3pm)in the User Contributed Perl Documentation. so if you're reading this on a wildly different perl, just, like, be aware. mwah, bye, go read your logs π§β¨
π¦ where this page comes from
- debian trixie: mtpolicyd 2.05-1.2 Β· GPL-2.0-only
- ubuntu questing: mtpolicyd 2.05-1.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms