added reply-to address

This commit is contained in:
Gitea 2023-01-29 08:46:10 +03:00
parent 028db01314
commit d01f5fc1bd
3 changed files with 14 additions and 5 deletions

View File

@ -2,10 +2,10 @@
# only for Russia!!! # only for Russia!!!
COUNTRY_CODE="7" COUNTRY_CODE="7"
SPOOLDIR="/srv/data/sms-outgoing/"
USER="smsd" USER="smsd"
GROUP="smsd" GROUP="smsd"
SPOOLDIR="/srv/data/sms/outgoing/"
if [ -z "$*" ]; then if [ -z "$*" ]; then
echo "Usage: ./sendsms.sh \"phone number\" \"message\"" echo "Usage: ./sendsms.sh \"phone number\" \"message\""
@ -40,13 +40,14 @@ if [[ ${#DST} != 11 ]]; then
exit -1 exit -1
fi fi
SMS=$(mktemp /tmp/sms_XXXXXXX) FILENAME="/tmp/"`date +"%Y.%m.%d-%H:%M:%S"`"_${DST}.XXXXX"
SMS=$(mktemp $FILENAME)
chown :${GROUP} ${SMS} chown :${GROUP} ${SMS}
chmod 0666 ${SMS} chmod 0666 ${SMS}
echo "To: ${DST}" >> $SMS echo "To: ${DST}" >> $SMS
echo "" >> $SMS echo "" >> $SMS
echo $MSG >> $SMS echo -en $MSG >> $SMS
mv ${SMS} ${SPOOLDIR} mv ${SMS} ${SPOOLDIR}

View File

@ -17,6 +17,9 @@ $config['pr_fields'] = [
// Admin email (this account will receive alerts when an user does not have an alternative email and phone) // Admin email (this account will receive alerts when an user does not have an alternative email and phone)
$config['pr_admin_email'] = 'postmaster@your.domain.com'; $config['pr_admin_email'] = 'postmaster@your.domain.com';
// Address to be indicated as reply-to in mail notifications
$config['pr_replyto_email'] = 'postmaster@your.domain.com';
// Use secret question/answer to confirmation password recovery // Use secret question/answer to confirmation password recovery
$config['pr_use_question'] = false; $config['pr_use_question'] = false;

View File

@ -35,7 +35,7 @@ class password_recovery_send {
$sms_send_function = $this->rc->config->get('pr_sms_send_function'); $sms_send_function = $this->rc->config->get('pr_sms_send_function');
if ($sms_send_function) { if ($sms_send_function) {
if (is_file($sms_send_function)) { if (is_file($sms_send_function)) {
$ret = (int) exec("$sms_send_function $to $message"); $ret = (int) exec("bash $sms_send_function $to $message");
} else if (is_callable($sms_send_function)) { } else if (is_callable($sms_send_function)) {
$ret = $sms_send_function($to, $message); $ret = $sms_send_function($to, $message);
} }
@ -126,9 +126,14 @@ class password_recovery_send {
$body = strtr(file_get_contents($file), ['[LINK]' => $link, '[CODE]' => $confirm_code]); $body = strtr(file_get_contents($file), ['[LINK]' => $link, '[CODE]' => $confirm_code]);
$subject = $this->pr->gettext('email_subject'); $subject = $this->pr->gettext('email_subject');
$from = $this->rc->config->get('pr_replyto_email');
if(!$from){
$from = get_email_from($this->rc->config->get('pr_admin_email'));
}
$send_email = $this->send_email( $send_email = $this->send_email(
$this->user['altemail'], $this->user['altemail'],
$this->get_email_from($this->rc->config->get('pr_admin_email')), $from,
$subject, $subject,
$body $body
); );