mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Add safety check to disable email authentication when not required
This commit is contained in:
parent
2c18293ace
commit
32635385fe
1 changed files with 8 additions and 1 deletions
|
|
@ -109,7 +109,14 @@ function email.sendEmail(subject, message_body, settings)
|
|||
end
|
||||
|
||||
local message = buildMessageHeader(os.time(), settings.from_addr, settings.to_addr, settings.cc_addr, subject, message_body)
|
||||
return ntop.sendMail(from, to, cc, message, smtp_server, settings.username, settings.password)
|
||||
|
||||
-- Pass nil username and password when auth is not required
|
||||
local username = nil
|
||||
local password = nil
|
||||
if not isEmptyString(settings.username) then username = settings.username end
|
||||
if not isEmptyString(settings.password) then password = settings.password end
|
||||
|
||||
return ntop.sendMail(from, to, cc, message, smtp_server, username, password)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue