From daf9694c7c5501e06e552a1b4ec24a3175632e6b Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 12 Jan 2022 12:04:56 -0700 Subject: [PATCH] Add from_address to the send_mail function for missed call emails. --- app/scripts/resources/scripts/app/hangup/index.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/scripts/resources/scripts/app/hangup/index.lua b/app/scripts/resources/scripts/app/hangup/index.lua index 20338c01f7..f4c1772d0e 100644 --- a/app/scripts/resources/scripts/app/hangup/index.lua +++ b/app/scripts/resources/scripts/app/hangup/index.lua @@ -53,6 +53,11 @@ local Database = require "resources.functions.database"; local dbh = Database.new('system'); + --prepare to get the settings + local Settings = require "resources.functions.lazy_settings" + local settings = Settings.new(dbh, domain_name, domain_uuid) + local from_address = settings:get('email', 'smtp_from', 'text'); + --get the templates local sql = "SELECT * FROM v_email_templates "; sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) "; @@ -75,7 +80,7 @@ headers["X-FusionPBX-Domain-Name"] = domain_name; headers["X-FusionPBX-Call-UUID"] = uuid; headers["X-FusionPBX-Email-Type"] = 'missed'; - + --remove quotes from caller id name and number caller_id_name = caller_id_name:gsub("'", "'"); caller_id_name = caller_id_name:gsub([["]], """); @@ -104,7 +109,7 @@ --send the emails send_mail(headers, - missed_call_data, + from_address, missed_call_data, {subject, body} );