feat: Add ENV option to enable subject line logging
This commit is contained in:
		
				
					committed by
					
						
						Juan Luis Baptiste
					
				
			
			
				
	
			
			
			
						parent
						
							f831f935b9
						
					
				
				
					commit
					f280c00f87
				
			@@ -31,3 +31,6 @@
 | 
			
		||||
 | 
			
		||||
# Optional: This will use allow you to set a custom $mydestination value. Default is localhost.
 | 
			
		||||
#DESTINATION=
 | 
			
		||||
 | 
			
		||||
# Optional: This will output the subject line of messages in the log.
 | 
			
		||||
#LOG_SUBJECT=yes
 | 
			
		||||
 
 | 
			
		||||
@@ -79,6 +79,8 @@ The following env variable(s) are optional.
 | 
			
		||||
 | 
			
		||||
* `DESTINATION` This will define a list of domains from which incoming messages will be accepted.
 | 
			
		||||
 | 
			
		||||
* `LOG_SUBJECT` This will output the subject line of messages in the log.
 | 
			
		||||
 | 
			
		||||
To use this container from anywhere, the 25 port or the one specified by `SMTP_PORT` needs to be exposed to the docker host server:
 | 
			
		||||
 | 
			
		||||
    docker run -d --name postfix -p "25:25"  \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								run.sh
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								run.sh
									
									
									
									
									
								
							@@ -61,11 +61,18 @@ fi
 | 
			
		||||
 | 
			
		||||
#Set header tag
 | 
			
		||||
if [ ! -z "${SMTP_HEADER_TAG}" ]; then
 | 
			
		||||
  postconf -e "header_checks = regexp:/etc/postfix/header_tag"
 | 
			
		||||
  echo -e "/^MIME-Version:/i PREPEND RelayTag: $SMTP_HEADER_TAG\n/^Content-Transfer-Encoding:/i PREPEND RelayTag: $SMTP_HEADER_TAG" > /etc/postfix/header_tag
 | 
			
		||||
  postconf -e "header_checks = regexp:/etc/postfix/header_checks"
 | 
			
		||||
  echo -e "/^MIME-Version:/i PREPEND RelayTag: $SMTP_HEADER_TAG\n/^Content-Transfer-Encoding:/i PREPEND RelayTag: $SMTP_HEADER_TAG" >> /etc/postfix/header_checks
 | 
			
		||||
  echo "Setting configuration option SMTP_HEADER_TAG with value: ${SMTP_HEADER_TAG}"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#Enable logging of subject line
 | 
			
		||||
if [ "${LOG_SUBJECT}" == "yes" ]; then
 | 
			
		||||
  postconf -e "header_checks = regexp:/etc/postfix/header_checks"
 | 
			
		||||
  echo -e "/^Subject:/ WARN" >> /etc/postfix/header_checks
 | 
			
		||||
  echo "Enabling logging of subject line"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#Check for subnet restrictions
 | 
			
		||||
nets='10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16'
 | 
			
		||||
if [ ! -z "${SMTP_NETWORKS}" ]; then
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user