Commit 1d3e54e0 authored by Dominika Liberda's avatar Dominika Liberda 💽 Committed by Dominika Liberda

fix bug in accounts, added better From: to mail handler

parent 9b803385
......@@ -71,6 +71,8 @@ function session_verify() {
# session_get_username(session)
function session_get_username() {
[[ "$1" == "" ]] && return
IFS=':'
local data=($(grep ":$1" secret/users.dat))
unset IFS
......
......@@ -3,8 +3,12 @@
# mailgen(from, to, subject, msg)
function mailgen() {
echo "From: $1
To: $2
if [[ "$sender_name" != "" ]]; then
echo "From: $sender_name <$1>"
else
echo "From: $1"
fi
echo "To: $2
Subject: $3
$4"
......@@ -13,7 +17,7 @@ $4"
# mailsend(to, subject, msg)
function mailsend() {
tmp="$(mktemp)"
mailgen "${cfg[mail]}" "$1" "$2" "$3" > "$tmp"
sender_name="$sender_name" mailgen "${cfg[mail]}" "$1" "$2" "$3" > "$tmp"
curl \
$([[ ${cfg[mail_ignore_bad_cert]} == true ]] && printf -- "-k") \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment