From 71147dcb7eff57862efd66f09d27b98b19f5625e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 29 Dec 2021 15:08:28 -0700 Subject: [PATCH] Have the email.lua function use the send_mail function. --- app/scripts/resources/scripts/email.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app/scripts/resources/scripts/email.lua b/app/scripts/resources/scripts/email.lua index ab521830f6..37c4403e0b 100644 --- a/app/scripts/resources/scripts/email.lua +++ b/app/scripts/resources/scripts/email.lua @@ -1,6 +1,6 @@ -- email.lua -- Part of FusionPBX --- Copyright (C) 2010 Mark J Crane +-- Copyright (C) 2010 - 291 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -38,6 +38,9 @@ --Example --luarun email.lua to@domain.com from@domain.com 'headers' 'subject' 'body' +--- include libs + local send_mail = require 'resources.functions.send_mail' + --get the argv values script_name = argv[0]; to = argv[1]; @@ -58,19 +61,19 @@ --send the email if (file == nil) then - freeswitch.email(to, + send_mail(headers, from, - "To: "..to.."\nFrom: "..from.."\nX-Headers: "..headers.."\nSubject: "..subject, - body - ); + to, + {subject, body} + ); else if (convert_cmd == nil) then - freeswitch.email(to, + send_mail(headers, from, - "To: "..to.."\nFrom: "..from.."\nX-Headers: "..headers.."\nSubject: "..subject, - body, + to, + {subject, body}, file - ); + ); else freeswitch.email(to, from, @@ -83,7 +86,3 @@ end end ---delete the file - if (delete == "true") then - os.remove(file); - end