From 3f144a35a4d299fe34f4cea8487dbb72e65d63ca Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 3 Jan 2022 15:31:30 -0700 Subject: [PATCH] Add from in a few more places. --- .../scripts/resources/functions/send_mail.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/scripts/resources/scripts/resources/functions/send_mail.lua b/app/scripts/resources/scripts/resources/functions/send_mail.lua index 703ddd1cd4..0a52466ef7 100644 --- a/app/scripts/resources/scripts/resources/functions/send_mail.lua +++ b/app/scripts/resources/scripts/resources/functions/send_mail.lua @@ -159,7 +159,7 @@ else local sendmail = require "sendmail" local uuid = require "uuid" - function send_mail(headers, address, message, file) + function send_mail(headers, from, address, message, file) 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' @@ -229,7 +229,7 @@ else end if freeswitch then - function send_mail(headers, address, message, file) + function send_mail(headers, from, address, message, file) 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' @@ -242,15 +242,22 @@ else end xheaders = xheaders:sub(1,-2) .. '}' - local from = settings:get('email', 'smtp_from', 'text') - local from_name = settings:get('email', 'smtp_from_name', 'text') + if (from == nil or from == "") then + from = settings:get('email', 'smtp_from', 'text') + from_name = settings:get('email', 'smtp_from_name', 'text') + end 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 '' + + --debug info + --freeswitch.consoleLog("notice", "[voicemail] from: " .. from .. "\n"); + --freeswitch.consoleLog("notice", "[voicemail] subject: " .. subject .. "\n"); local mail_headers = "To: ".. address .. "\n" ..