recreate
This commit is contained in:
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
# File name: mlmmj-amime-receive
|
||||
# Purpose: Read mail messages from stdin, pipe it to altermime to add footer
|
||||
# in MIME-aware way, then pipe modified message to mlmmj-receive for
|
||||
# final delivery.
|
||||
#
|
||||
# Requirements:
|
||||
# - altermime: http://www.pldaniels.com/altermime/
|
||||
#
|
||||
# Authors:
|
||||
# - Original wrote by Gerd v. Egidy <gerd@egidy.de>, MIT License.
|
||||
# - Updated by Zhang Huangbin <zhb@iredmail.org>.
|
||||
|
||||
export PATH="/usr/bin:/usr/local/bin:/bin:/sbin:/usr/sbin:/usr/local/sbin:$PATH"
|
||||
|
||||
# All `mlmmj-*` programs must be ran with absolute path to the program.
|
||||
if [[ -x /usr/local/bin/mlmmj-receive ]]; then
|
||||
export CMD_MLMMJ_RECEIVE='/usr/local/bin/mlmmj-receive'
|
||||
else
|
||||
export CMD_MLMMJ_RECEIVE='/usr/bin/mlmmj-receive'
|
||||
fi
|
||||
|
||||
if [[ -x /usr/local/bin/altermime ]]; then
|
||||
export CMD_ALTERMIME='/usr/local/bin/altermime'
|
||||
else
|
||||
export CMD_ALTERMIME='/usr/bin/altermime'
|
||||
fi
|
||||
|
||||
# File names used to store footer in different MIME types:
|
||||
# plain text, html, base64 encoded.
|
||||
# WARNING: both `footer_text` and `footer_html` must exist.
|
||||
export FILE_FOOTER_TEXT='footer_text'
|
||||
export FILE_FOOTER_HTML='footer_html'
|
||||
|
||||
# Make sure command `mlmmj-receive` exist and executable
|
||||
if [ ! -x ${CMD_MLMMJ_RECEIVE} ]; then
|
||||
echo "Command ${CMD_MLMMJ_RECEIVE} doesn't exist or not executable, mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get mailing list directory passed to '-L' argument
|
||||
ML_DIR=''
|
||||
_has_L='NO'
|
||||
for i in $@; do
|
||||
if [ X"${_has_L}" == X'NO' ]; then
|
||||
if [ X"$i" == X'-L' ]; then
|
||||
_has_L='YES'
|
||||
fi
|
||||
else
|
||||
ML_DIR="$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ X"${ML_DIR}" == X'' ]; then
|
||||
echo "No mailing list directory specified (-L /path/to/listdir), mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${ML_DIR}" ]; then
|
||||
echo "Mailing list directory (${ML_DIR}) does not exist or not a directory, mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Mailing list sub-directory: control
|
||||
ML_SUBDIR_CONTROL="${ML_DIR}/control"
|
||||
|
||||
if [ ! -d "${ML_SUBDIR_CONTROL}" ]; then
|
||||
echo "Mailing list control directory (${ML_SUBDIR_CONTROL}) does not exist or not a directory, mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Path to footer files
|
||||
PATH_FOOTER_TEXT="${ML_SUBDIR_CONTROL}/${FILE_FOOTER_TEXT}"
|
||||
PATH_FOOTER_HTML="${ML_SUBDIR_CONTROL}/${FILE_FOOTER_HTML}"
|
||||
|
||||
# go to a dir where altermime can write it's tmp-files safely
|
||||
cd ${ML_DIR}
|
||||
|
||||
if [[ -x ${CMD_ALTERMIME} ]] && [[ -f ${PATH_FOOTER_TEXT} ]] && [[ -f ${PATH_FOOTER_HTML} ]]; then
|
||||
# pipe to altermime for MIME modification, then pipe to mlmmj-receive for final delivery.
|
||||
${CMD_ALTERMIME} --input=- \
|
||||
--altersigned \
|
||||
--log-syslog \
|
||||
--disclaimer=${PATH_FOOTER_TEXT} \
|
||||
--disclaimer-html=${PATH_FOOTER_HTML} \
|
||||
--htmltoo \
|
||||
--force-for-bad-html | ${CMD_MLMMJ_RECEIVE} "$@"
|
||||
else
|
||||
echo "Mail delivered without modificaiton."
|
||||
${CMD_MLMMJ_RECEIVE} "$@"
|
||||
fi
|
||||
@@ -0,0 +1,49 @@
|
||||
############################################################
|
||||
# DO NOT TOUCH THIS LINE.
|
||||
from libs.default_settings import *
|
||||
############################################################
|
||||
|
||||
# Listen address and port
|
||||
listen_address = 'PH_MLMMJADMIN_BIND_HOST'
|
||||
listen_port = PH_MLMMJADMIN_LISTEN_PORT
|
||||
|
||||
# Run as a non-privileged user/group.
|
||||
run_as_user = 'PH_SYS_USER_MLMMJ'
|
||||
run_as_group = 'PH_SYS_GROUP_MLMMJ'
|
||||
|
||||
# Pid file
|
||||
pid_file = 'PH_MLMMJADMIN_PID_FILE'
|
||||
|
||||
# Log level: info, debug.
|
||||
log_level = 'info'
|
||||
|
||||
# Specify the backend used to query/update meta data stored in SQL/LDAP.
|
||||
#
|
||||
# - `backend_api` is used when accessing RESTful API.
|
||||
# - `backend_cli` is used when you're managing mailing list account with
|
||||
# command line tool like `tools/maillist_admin.py`.
|
||||
#
|
||||
# Different backends may require different parameters in settings.py, please
|
||||
# read the comment lines in `backends/bk_*.py`.
|
||||
#
|
||||
# Available backends:
|
||||
#
|
||||
# - bk_iredmail_ldap: for iRedMail with OpenLDAP backend
|
||||
# - bk_iredmail_sql: for iRedMail with SQL backends (MySQL, MariaDB, PostgreSQL)
|
||||
# - bk_none: pure mlmmj, no SQL/LDAP database.
|
||||
#
|
||||
# WARNING: For iRedMail users, if you don't have iRedAdmin-Pro, please enable
|
||||
# proper backend below so that mlmmjadmin will store mailing list accounts in
|
||||
# SQL/LDAP database.
|
||||
backend_api = 'bk_none'
|
||||
backend_cli = 'bk_none'
|
||||
|
||||
# A list of API AUTH tokens (secret strings) used for authentication.
|
||||
# It's strong recommended to use a long string as auth token, program will log
|
||||
# first 8 characters to help you identity the client.
|
||||
api_auth_tokens = ['PH_MLMMJADMIN_API_AUTH_TOKEN']
|
||||
|
||||
MLMMJ_SPOOL_DIR = 'PH_MLMMJ_SPOOL_DIR'
|
||||
MLMMJ_ARCHIVE_DIR = 'PH_MLMMJ_ARCHIVE_DIR'
|
||||
MLMMJ_SKEL_DIR = 'PH_MLMMJ_SKEL_DIR'
|
||||
MLMMJ_DEFAULT_PROFILE_SETTINGS.update({'smtp_port': PH_AMAVISD_MLMMJ_PORT})
|
||||
Reference in New Issue
Block a user