diff --git a/src/libs/zbxhttp/http.c b/src/libs/zbxhttp/http.c index 1a42631f64c..ce485c1710b 100644 --- a/src/libs/zbxhttp/http.c +++ b/src/libs/zbxhttp/http.c @@ -971,7 +971,7 @@ void zbx_http_convert_to_utf8(CURL *easyhandle, char **body, size_t *size, size_ CURLcode err = curl_easy_getinfo(easyhandle, CURLINFO_CONTENT_TYPE, &content_type); if (CURLE_OK != err || NULL == content_type) - zabbix_log(LOG_LEVEL_DEBUG, "cannot get content type: %s", curl_easy_strerror(err)); + zabbix_log(LOG_LEVEL_DEBUG, "cannot get content type: %s", curl_easy_strerror(err)); else zabbix_log(LOG_LEVEL_DEBUG, "content_type '%s'", content_type); #endif diff --git a/src/libs/zbxmedia/email.c b/src/libs/zbxmedia/email.c index 20cc7e07ec8..449ff0f8f3d 100644 --- a/src/libs/zbxmedia/email.c +++ b/src/libs/zbxmedia/email.c @@ -935,6 +935,26 @@ static void zbx_mailaddr_free(zbx_mailaddr_t *mailaddr) zbx_free(mailaddr); } +static int curl_supports_protocol(const char *protocol, char *error, size_t max_error_len) +{ + curl_version_info_data *ver; + size_t index = 0; + + ver = curl_version_info(CURLVERSION_NOW); + + while (NULL != ver->protocols[index]) + { + if (0 == strcasecmp(protocol, ver->protocols[index])) + return SUCCEED; + + index++; + } + + zbx_snprintf(error, max_error_len, "cURL library was compiled without support for \"%s\" protocol", protocol); + + return FAIL; +} + int send_email(const char *smtp_server, unsigned short smtp_port, const char *smtp_helo, const char *smtp_email, const char *mailto, const char *inreplyto, const char *mailsubject, const char *mailbody, unsigned char smtp_security, unsigned char smtp_verify_peer, unsigned char smtp_verify_host, @@ -968,6 +988,12 @@ int send_email(const char *smtp_server, unsigned short smtp_port, const char *sm } else { + if (FAIL == curl_supports_protocol("smtp", error, max_error_len)) + goto clean; + + if (FAIL == curl_supports_protocol("smtps", error, max_error_len)) + goto clean; + ret = send_email_curl(smtp_server, smtp_port, smtp_helo, &from_mails, &to_mails, inreplyto, mailsubject, mailbody, smtp_security, smtp_verify_peer, smtp_verify_host, smtp_authentication, username, password, content_type, timeout, config_source_ip, config_ssl_ca_location,