Have the email.lua function use the send_mail function.

This commit is contained in:
FusionPBX 2021-12-29 15:08:28 -07:00 committed by GitHub
parent 2c7cfbe44f
commit 71147dcb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 13 deletions

View File

@ -1,6 +1,6 @@
-- email.lua
-- Part of FusionPBX
-- Copyright (C) 2010 Mark J Crane <markjcrane@fusionpbx.com>
-- Copyright (C) 2010 - 291 Mark J Crane <markjcrane@fusionpbx.com>
-- 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