From cdd7c2bd9787cf1ab5e51a768ed64edf007e7d70 Mon Sep 17 00:00:00 2001 From: Mafoo Date: Wed, 7 Feb 2018 00:45:53 +0000 Subject: [PATCH] Enhance - send_mail.lua (#2978) use the to address when email:smtp_from:var is empty don't use email:smtp_from_name:var when empty --- .../install/scripts/resources/functions/send_mail.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/resources/functions/send_mail.lua b/resources/install/scripts/resources/functions/send_mail.lua index ba58921573..3f8b96aa33 100644 --- a/resources/install/scripts/resources/functions/send_mail.lua +++ b/resources/install/scripts/resources/functions/send_mail.lua @@ -1,4 +1,3 @@ - local Settings = require "resources.functions.lazy_settings" local Database = require "resources.functions.database" @@ -91,6 +90,12 @@ if freeswitch then xheaders = xheaders:sub(1,-2) .. '}' local from = settings:get('email', 'smtp_from', 'var') + local from_name = settings:get('email', 'smtp_from_name', 'var') + if from == nil or from == "" then + from = address + elseif from_name ~= nil and from_name ~= "" then + from = from_name .. "<" .. from .. ">" + end local subject = message[1] local body = message[2] or ''