Skip to content
Snippets Groups Projects
Commit 98deb8e2 authored by Ondřej Caletka's avatar Ondřej Caletka
Browse files

[mail_notifier] Router hostname in message subject

This adds router host name into the subject of e-mail notification,
which is useful if someone has more than one Turris router.
parent 40a23c31
No related branches found
No related tags found
No related merge requests found
......@@ -122,6 +122,12 @@ compose_message() {
local rand=`tr -dc A-Za-z0-9 < /dev/urandom 2>/dev/null | head -c8`
local domain=`uci get user_notify.smtp.from | cut -d '@' -f2`
local msg_id="<$date_time.$rand@$domain>"
local hostname=`cat /proc/sys/kernel/hostname`
if [ "$lang" = "cs" ]; then
local mail_subject="=?utf-8?Q?Upozorn=C4=9Bn=C3=AD?= od =?utf-8?Q?Va=C5=A1eho?= routeru $hostname"
else
local mail_subject="Notification from your router $hostname"
fi
local msg_list=`ls "$base_folder"`
for msg in $msg_list; do
......@@ -201,7 +207,7 @@ compose_message() {
echo "Content-Type: text/plain; charset=UTF-8" >> "$msg_file"
echo "Date: $curr_date" >> "$msg_file"
echo "Message-ID: $msg_id" >> "$msg_file"
echo -e "Subject: =?utf-8?Q?Upozorn=C4=9Bn=C3=AD?= od =?utf-8?Q?Va=C5=A1eho?= routeru Turris\n" >> "$msg_file"
echo -e "Subject: $mail_subject\n" >> "$msg_file"
cat $msg_file.tmp >> "$msg_file"
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment