diff --git a/src/Utils.cpp b/src/Utils.cpp index 0f9f14fad718..de1389b5696d 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -2071,10 +2071,10 @@ bool Utils::sendMail(lua_State *vm, char *from, char *to, char *cc, ret_str = curl_easy_strerror(res); if (res != CURLE_OK) { - ntop->getTrace()->traceEvent(TRACE_WARNING, - "Unable to send email to (%s): %s. Run " - "ntopng with -v6 for more details.", + ntop->getTrace()->traceEvent(TRACE_WARNING, "Unable to send email to (%s): %s", smtp_server, curl_easy_strerror(res)); + if (ntop->getTrace()->get_trace_level() < TRACE_LEVEL_DEBUG && !verbose) + ntop->getTrace()->traceEvent(TRACE_WARNING, "Run ntopng with -v6 for more details"); ret = false; } @@ -2100,15 +2100,17 @@ bool Utils::sendMail(lua_State *vm, char *from, char *to, char *cc, lua_newtable(vm); lua_push_bool_table_entry(vm, "success", ret); lua_push_str_table_entry(vm, "msg", ret_str); - } else if (!ret) + } else if (!ret) { /* If not lua VM has been passed, in case of error, a message is logged to stdout */ - ntop->getTrace()->traceEvent(TRACE_WARNING, - "Unable to send email to (%s): %s. Run ntopng " - "with -v6 for more details.", + ntop->getTrace()->traceEvent(TRACE_WARNING, "Unable to send email to (%s): %s", smtp_server, ret_str); + if (ntop->getTrace()->get_trace_level() < TRACE_LEVEL_DEBUG && !verbose) + ntop->getTrace()->traceEvent(TRACE_WARNING, "Run ntopng with -v6 for more details"); + } + return ret; }