From e06f21ccf335fb8094e5638e380628d02ce9c71f Mon Sep 17 00:00:00 2001 From: Mafoo Date: Sat, 3 Feb 2018 02:33:43 +0000 Subject: [PATCH] BugFix - LUA send_mail() (#2975) take call_uuid from the correct header use smtp_from_name as part of the from address --- .../install/scripts/resources/functions/send_mail.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/install/scripts/resources/functions/send_mail.lua b/resources/install/scripts/resources/functions/send_mail.lua index 8adab11d49..384a4e89f8 100644 --- a/resources/install/scripts/resources/functions/send_mail.lua +++ b/resources/install/scripts/resources/functions/send_mail.lua @@ -82,7 +82,7 @@ if freeswitch then local domain_uuid = headers["X-FusionPBX-Domain-UUID"] local domain_name = headers["X-FusionPBX-Domain-Name"] local email_type = headers["X-FusionPBX-Email-Type"] or 'info' - local call_uuid = headers["X-FusionPBX-Email-Type"] + local call_uuid = headers["X-FusionPBX-Email-Call-UUID"] local db = dbh or Database.new('system') local settings = Settings.new(db, domain_name, domain_uuid) local xheaders = "{" @@ -92,19 +92,21 @@ if freeswitch then xheaders = xheaders:sub(1,-2) .. '}' local from = settins:get('email', 'smtp_from', 'var') + local from_name = settins:get('email', 'smtp_from_name', 'var') + local from_address = from_name .. "<" .. from .. ">" local subject = message[1] local body = message[2] or '' local mail_headers = "To: ".. address .. "\n" .. - "From: " .. from .. "\n" .. + "From: " .. from_address "\n" .. "Subject: " .. subject .. "\n" .. "X-Headers: " .. xheaders if file then - freeswitch.email(address, from, mail_headers, body, file) + freeswitch.email(address, from_address, mail_headers, body, file) else - freeswitch.email(address, from, mail_headers, body) + freeswitch.email(address, from_address, mail_headers, body) end end end