I have a flask applcation running on apache2 server. I wrote a test script in python to send mails using postfix:
import os
def send_mail(to, subject, msg):
os.system(f"echo {msg} | mail -s '{subject}' to")
When i run this script, it sends a mail to the target with the sender name like '[email protected]'. This is good. But, when I try to run same code in flask app, mail sender becomes '[email protected]' and I can't see any mail content. I tried to change envvars in /etc/apache2/envvars:
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
to:
export APACHE_RUN_USER=root
export APACHE_RUN_GROUP=root
(I have only one user and it's root)
but this time, apache unable to start saying
'[core:warn] [pid 38691] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot'
any ideas to fix this issue?
question from:
https://stackoverflow.com/questions/65846150/changing-apache2-envvar-causes-crash-does-not-send-mail-content 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…