Email bounce handling with postfix
This commit is contained in:
@@ -32,5 +32,28 @@ chmod 644 /etc/postfix/sender_access /etc/postfix/sender_access.db
|
||||
# Set permissions on MySQL config
|
||||
chmod 644 /etc/postfix/mysql_virtual_alias_maps.cf
|
||||
|
||||
# Configure bounce processing based on environment variable
|
||||
if [ "${ENABLE_EMAIL_BOUNCE_PROCESSING:-false}" = "true" ]; then
|
||||
echo "Email-based bounce processing enabled"
|
||||
# Regenerate aliases database to enable bounce processing
|
||||
newaliases
|
||||
chmod 644 /etc/aliases /etc/aliases.db
|
||||
|
||||
# Generate smtp generic maps to ensure bounces come to our bounce address
|
||||
postmap /etc/postfix/smtp_generic
|
||||
chmod 644 /etc/postfix/smtp_generic /etc/postfix/smtp_generic.db
|
||||
echo "Configured return path rewriting to bounces@lists.sasalliance.org"
|
||||
else
|
||||
echo "Email-based bounce processing disabled"
|
||||
# Create minimal aliases without bounce processing
|
||||
echo "postmaster: root" > /etc/aliases
|
||||
echo "root: postmaster" >> /etc/aliases
|
||||
newaliases
|
||||
|
||||
# Disable smtp generic maps
|
||||
echo "# Email bounce processing disabled" > /etc/postfix/smtp_generic
|
||||
postmap /etc/postfix/smtp_generic
|
||||
fi
|
||||
|
||||
# Start Postfix in foreground
|
||||
exec postfix start-fg
|
||||
|
||||
Reference in New Issue
Block a user