Skip to content

Commit

Permalink
centmin.sh menu option 22 wordpress allow from email override
Browse files Browse the repository at this point in the history
Update adds support to override the default email from address used by centmin.sh menu option 22's wp-cli installer and cronjob auto updater. By default wp-cli email notifications's email from address is the same as your wordpress administration defined email address. To override the from email address in emails sent via centmin.sh menu option 22 wp-cli initial install and cronjob wordpress auto updater so that it differs from wp administration email address (to email address), you can do it on a per domain vhost level or via global override following below instructions.

On per domain vhost level, before running centmin.sh menu option 22 wordpress install, you would create directory /usr/local/nginx/conf/wpincludes/$vhostname and file at /usr/local/nginx/conf/wpincludes/$vhostname/emailfrom.ini where $vhostname = your intended wordpress domain name (without www. prefix) i.e. domain.com would have directory created at /usr/local/nginx/conf/wpincludes/domain.com and within the /usr/local/nginx/conf/wpincludes/domain.com/emailfrom.ini file assign to the variable SETWPADMINEMAIL_FROM your intended from email address that wp-cli update email notifications are sent from.

SETWPADMINEMAIL_FROM=yourcustom-from-emailaddress

On a global level so all subsequent centmin.sh menu option 22 created wordpress installs use the same from email address, set in persistent config file /etc/centminmod/custom_config.inc the variable SETWPADMINEMAIL_FROM your intended from email address that wp-cli update email notifications are sent from.

SETWPADMINEMAIL_FROM=yourcustom-from-emailaddress

Per domain vhost level takes higher priority if both per domain vhost level and global level are set. So you can have a global from email address for most wordpress installs and a per vhost level one for a specific domain vhost if you want
  • Loading branch information
centminmod committed Apr 25, 2018
1 parent 4ecdf2e commit 969ba9e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions inc/wpsetup.inc
Expand Up @@ -2363,11 +2363,23 @@ chmod 0700 /root/tools/wp_uninstall_${vhostname}.sh
cecho "/root/tools/wp_updater_${vhostname}.sh" $boldyellow
cecho "------------------------------------------------------------" $boldgreen


if [ -f "/usr/local/nginx/conf/wpincludes/$vhostname/emailfrom.ini" ]; then
# SETWPADMINEMAIL_FROM=yourcustom-from-emailaddress
. "/usr/local/nginx/conf/wpincludes/$vhostname/emailfrom.ini"
fi

if [[ "$SETWPADMINEMAIL_FROM" ]]; then
WPADMINEMAIL_FROM="$SETWPADMINEMAIL_FROM"
else
WPADMINEMAIL_FROM="$WPADMINEMAIL"
fi

cat > "/root/tools/wp_updater_${vhostname}.sh" <<ENDA
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/bin
EMAIL=$WPADMINEMAIL
EMAILFROM=$WPADMINEMAIL
EMAILFROM=$WPADMINEMAIL_FROM
DT=\$(date +"%d%m%y-%H%M%S")

{
Expand Down Expand Up @@ -2693,7 +2705,7 @@ elif [[ "$wpscache" = 'redis' ]]; then
cecho "------------------------------------------------------------" $boldgreen
fi
} 2>&1 | tee /tmp/setupwp.log
cat -v /tmp/setupwp.log | /usr/bin/tr -cd '\11\12\15\40-\176' | perl -pe 's/\x1b.*?[mGKH]//g' | dos2unix | mail -r $WPADMINEMAIL -s "${vhostname} Wordpress Installed `date`" $WPADMINEMAIL
cat -v /tmp/setupwp.log | /usr/bin/tr -cd '\11\12\15\40-\176' | perl -pe 's/\x1b.*?[mGKH]//g' | dos2unix | mail -r $WPADMINEMAIL_FROM -s "${vhostname} Wordpress Installed `date`" $WPADMINEMAIL
cp -a /tmp/setupwp.log "${CENTMINLOGDIR}/setupwp-$(date +"%d%m%y-%H%M%S").log"
rm -rf /tmp/setupwp.log

Expand Down

0 comments on commit 969ba9e

Please sign in to comment.