diff options
Diffstat (limited to 'src/message/sender.cpp')
-rw-r--r-- | src/message/sender.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/message/sender.cpp b/src/message/sender.cpp index 85c5d5d..a7e3128 100644 --- a/src/message/sender.cpp +++ b/src/message/sender.cpp @@ -76,11 +76,18 @@ namespace smtp::message { return false; } - curl_easy_setopt( curl, CURLOPT_USERNAME, mSettingsStorage.GetUserName().c_str()); - curl_easy_setopt( curl, CURLOPT_PASSWORD, mSettingsStorage.GetPassword().c_str()); + + if( mSettingsStorage.IsNeedAuth()) + { + curl_easy_setopt( curl, CURLOPT_USERNAME, mSettingsStorage.GetUserName().c_str()); + curl_easy_setopt( curl, CURLOPT_PASSWORD, mSettingsStorage.GetPassword().c_str()); + } + curl_easy_setopt( curl, CURLOPT_URL, GetHostPortData().c_str()); - curl_easy_setopt( curl, CURLOPT_USE_SSL, ( long ) CURLUSESSL_ALL ); + mSettingsStorage.IsNeedSsl() ? curl_easy_setopt( curl, CURLOPT_USE_SSL, ( long ) CURLUSESSL_ALL ) : + curl_easy_setopt( curl, CURLOPT_USE_SSL, ( long ) CURLUSESSL_NONE ); + curl_easy_setopt( curl, CURLOPT_MAIL_FROM, mail_from.c_str()); curl_easy_setopt( curl, CURLOPT_READFUNCTION, ReadCallBack ); |