Add option to overwrite the From address
This commit is contained in:
		@@ -55,6 +55,10 @@ The following env variable(s) are optional.
 | 
			
		||||
    -v $(pwd)/secrets/:/secrets/
 | 
			
		||||
* `ALWAYS_ADD_MISSING_HEADERS` This is related to the [always\_add\_missing\_headers](http://www.postfix.org/postconf.5.html#always_add_missing_headers) Postfix option (default: `no`). If set to `yes`, Postfix will always add missing headers among `From:`, `To:`, `Date:` or `Message-ID:`.
 | 
			
		||||
 | 
			
		||||
* `OVERWRITE_FROM` This will rewrite the from address overwriting it with the specified address for all email being relayed. Example settings:
 | 
			
		||||
    OVERWRITE_FROM=email@company.com
 | 
			
		||||
    OVERWRITE_FROM="Your Name" <email@company.com>
 | 
			
		||||
 | 
			
		||||
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"  \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								run.sh
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								run.sh
									
									
									
									
									
								
							@@ -68,6 +68,13 @@ if [ ! -z "${SMTP_NETWORKS}" ]; then
 | 
			
		||||
fi
 | 
			
		||||
add_config_value "mynetworks" "${nets}"
 | 
			
		||||
 | 
			
		||||
if [ ! -z "${OVERWRITE_FROM}" ]; then
 | 
			
		||||
  echo -e "/^From:.*$/ REPLACE From: $OVERWRITE_FROM" > /etc/postfix/smtp_header_checks
 | 
			
		||||
  postmap /etc/postfix/smtp_header_checks
 | 
			
		||||
  postconf -e 'smtp_header_checks = regexp:/etc/postfix/smtp_header_checks'
 | 
			
		||||
  echo "Setting configuration option OVERWRITE_FROM with value: ${OVERWRITE_FROM}"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#Start services
 | 
			
		||||
 | 
			
		||||
# If host mounting /var/spool/postfix, we need to delete old pid file before
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user