Load-Balance PaperCut ETP Print Queues using Postfix

Overview

ETP Load Balancing for PaperCut using Postfix

This script is designed to allow you to load balance a single Email-To-Print address against multiple print queues using the PaperCut print solution and the open-source Postfix MTA.

PaperCut, by default, allows the administrator to configure a specific TO address for each print queue. This is designed for a mailbox that has multiple aliases against it, as the solution can only connect to a single IMAP mailbox.

When load balancing is required, for example, when a large number of Email-To-Print jobs are expected and only a single email can be provided, this feature can be utilised to balance the incoming jobs against multiple print queues/print servers.

In order to do this, we must intercept the mail handling and dynamically rewrite the TO header before the mail is delivered to the IMAP box that PaperCut is watching. This is achieved by the PHP script enclosed, which is a simple script that accepts a message via STDIN and queues the message in the desired users spool file.

Installation Instructions

Ensure the system as PHP 7 or greater installed. No other dependencies are required (other than the Postfix MTA itself). This README will not cover the configuration of Postfix, it is assumed that the MTA has already been configured and is accepting mail for the desired domain.

Note: The following instructions will redirect an Entire Domain to the load balancing script. This is intended when a specific domain is being used for Email to Print. If you wish to only redirect a specific mailbox, you will need to adjust the Postfix configuration appropriately.

  • Create a local user that will hold the mailbox for PaperCut to connect to. In this example, we will use 'etpmailbox':

adduser etpmailbox

  • Place the PHP script in the users home directory. In this example, the path to the script will be:

/home/etpmailbox/handler.php

  • Modify /etc/postfix/master.cf to enable our script as a mail handler:
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
emailprint unix  -       n       n       -       -       pipe
  flags=FR user=etpmailbox argv=/home/etpmailbox/handler.php ${sender} ${size} ${recipient}
  • Modify /etc/postfix/main.cf as per the comment from master.cf above:

emailprint_destination_recipient_limit=1

  • Modify /etc/postfix/transport to redirect email from our ETP domain to our new mail handler:

your-etp-domain.co.uk emailprint

  • Generate/Regenerate transport.db:

postmap /etc/postfix/transport

  • Restart the Postfix service to reload the configuration changes:

systemctl restart postfix

  • Add the Email-To-Print user to the mail group so it can append to the spool files:

adduser etpmailbox mail

You might also like...
A research raw data repository for researchers of Arba Minch University built using Codeigniter which follows MVC architecture. The front-end is build using Bootstrap.

Arba Minch University Dataset Repository This system is a research dataset repository for Arba Minch University researchers and is build using Codeign

Serialize closures. Not maintained. Consider using opis/closure.

PHP SuperClosure A PHP Library for serializing closures and anonymous functions. No Longer Maintained This software is no longer maintained. Consider

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

A PHP library to convert text to speech using various services

speaker A PHP library to convert text to speech using various services

Laradeploy offers you to automate deployment using a GitHub webhook.

Introduction Laradeploy offers you to automate deployment using a GitHub webhook. Simple and fast just make a git push to GitHub deploy the new modifi

Xenon\LaravelBDSms is a sms gateway package for sending text message to Bangladeshi mobile numbers using several gateways like sslcommerz, greenweb, dianahost,metronet in Laravel framework

Xenon\LaravelBDSms is a sms gateway package for sending text message to Bangladeshi mobile numbers using several gateways for Laravel. You should use

 Rafel is Remote Access Tool Used to Control Victims Using WebPanel With More Advance Features..
Rafel is Remote Access Tool Used to Control Victims Using WebPanel With More Advance Features..

Rafel is Remote Access Tool Used to Control Victims Using WebPanel With More Advance Features..

This is a PocketMine plugin that helps staffs track players using commands.
This is a PocketMine plugin that helps staffs track players using commands.

Track This is a PocketMine plugin that helps staffs track players using commands. Features Allows selected staffs to watch players use commands to fac

Fly50W is a new language which helps you build simple apps using more than 500k lines of code easily.

Fly50W is a new language which helps you build simple apps using more than 500k lines of code easily. Installation

Owner
Bottswana
Bottswana
Laravel & Solana Phantom wallet example built with Bootstrap, JQuery. App connects to Phantom wallet and fetching publicKey and balance information.

Phantom Wallet Authentication Example Laravel & Solana ($SOL) Phantom wallet example built with Bootstrap, JQuery. This is a Web 3.0 app that connects

Solanacraft 3 Oct 19, 2022
PPM is a process manager, supercharger and load balancer for modern PHP applications.

PPM - PHP Process Manager PHP-PM is a process manager, supercharger and load balancer for PHP applications. It's based on ReactPHP and works best with

PPM - PHP Process Manager 6.5k Jan 3, 2023
The game is implemented as an example of scalable and high load architecture combined with modern software development practices

Crossword game The game is implemented as an example of scalable and high load architecture combined with modern software development practices Exampl

Roman 56 Oct 27, 2022
Helper to automatically load various Kirby extensions in a plugin

Autoloader for Kirby Helper to automatically load various Kirby extensions in a plugin Commerical Usage This package is free but if you use it in a co

Bruno Meilick 13 Nov 9, 2022
Plugin for Kirby that allows you to load assets generated by Vite.

Kirby Vite Plugin Plugin for Kirby that allows you to load assets generated by Vite. In development mode, assets are loaded from Vite's development se

Oblik Studio 10 Nov 20, 2022
Simple way to auto load modules without complicate definition of routes

Phalcon-autorouter Version 2.0 Example full application with various libraries included in this example Change log Structure have been changed and upd

Kamil 28 Dec 27, 2022
Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Strategery 123 Nov 20, 2021
This script is used to load datas (Anteriorite) in Alfresco

This script is used to load datas (Anteriorite) in Alfresco

Bureau National de l'Etat Civil 0 Sep 28, 2022
A horrendous PM plugin to manually load all the chunks in your world without logging on. Only for the sole purpose of aiding in PM4 -> DF world conversion.

ChunkLoader A horrendous PM plugin to manually load all the chunks in your world without logging on. Only for the sole purpose of aiding in PM4 -> DF

null 2 Aug 10, 2022
This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

Kraken 48 Aug 11, 2021