summaryrefslogtreecommitdiff
path: root/tex/context/base/util-soc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/util-soc.lua')
-rw-r--r--tex/context/base/util-soc.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/tex/context/base/util-soc.lua b/tex/context/base/util-soc.lua
index 30301c510..3a52ee86d 100644
--- a/tex/context/base/util-soc.lua
+++ b/tex/context/base/util-soc.lua
@@ -25,17 +25,17 @@ function mail.send(specification)
local server = specification.server or ""
if not server then
report_mail("no server specified")
- return false
+ return false, "invalid server"
end
local to = specification.to or specification.recepient or ""
if to == "" then
- report_mail("no recepient specified")
- return false
+ report_mail("no recipient specified")
+ return false, "invalid recipient"
end
local from = specification.from or specification.sender or ""
if from == "" then
report_mail("no sender specified")
- return false
+ return false, "invalid sender"
end
local message = { }
local body = specification.body
@@ -68,11 +68,13 @@ function mail.send(specification)
end
end
end
+ local user = specification.user
+ local password = specification.password
local result, detail = smtp.send {
server = specification.server,
port = specification.port,
- user = specification.user,
- password = specification.password,
+ user = user ~= "" and user or nil,
+ password = password ~= "" and password or nil,
from = from,
rcpt = to,
source = smtp.message {
@@ -87,7 +89,9 @@ function mail.send(specification)
}
if detail then
report_mail("error: %s",detail)
+ return false, detail
else
report_mail("message sent")
+ return true
end
end