[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 19/23] optional smtp user/pass, print smtp status


MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

From: arf20 <aruizfernandez05@xxxxxxxxx>

---
 alert.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/alert.c b/alert.c
index 1499670..2aef5ff 100644
--- a/alert.c
+++ b/alert.c
@@ -117,9 +117,10 @@ send_email(const target_t *target, const char *address,
     curl_easy_setopt(curl, CURLOPT_URL, alert_config.mail_server);
     curl_easy_setopt(curl, CURLOPT_MAIL_FROM, alert_config.from);
 
-    curl_easy_setopt(curl, CURLOPT_USERNAME, alert_config.user);
-    curl_easy_setopt(curl, CURLOPT_PASSWORD, alert_config.password);
-
+    if (alert_config.user) {
+        curl_easy_setopt(curl, CURLOPT_USERNAME, alert_config.user);
+        curl_easy_setopt(curl, CURLOPT_PASSWORD, alert_config.password);
+    }
     
     time_t now = time(NULL);
     struct tm *tm_now = gmtime(&now);
@@ -146,9 +147,8 @@ send_email(const target_t *target, const char *address,
 
     CURLcode curl_code = curl_easy_perform(curl);
     if (curl_code != CURLE_OK) {
-        printf("curl_easy_perform() failed: %s\n",
+        printf("curl_easy_perform() failed: %s: ",
             curl_easy_strerror(curl_code));
-        return STATUS_DOWN;
     }
 
     long resp_code;
-- 
2.47.3


References:
[arfnet2-status PATCH 00/23] First releasearf20 <arf20@xxxxxxxxx>