diff options
| author | arf20 <aruizfernandez05@gmail.com> | 2025-11-10 23:02:40 +0100 |
|---|---|---|
| committer | arf20 <aruizfernandez05@gmail.com> | 2025-11-10 23:02:40 +0100 |
| commit | 26aedc1555186b3be00cf719c2376585035b86af (patch) | |
| tree | 0f87b0d1b2ef726311a62707be5b5d9351e04d6a /alert.c | |
| parent | 36b52bd0f856f1b6cfcf8ac1a7459f06939dfafa (diff) | |
| download | arfnet2-status-26aedc1555186b3be00cf719c2376585035b86af.tar.gz arfnet2-status-26aedc1555186b3be00cf719c2376585035b86af.zip | |
optional smtp user/pass, print smtp status
Diffstat (limited to 'alert.c')
| -rw-r--r-- | alert.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; |
