add a Http::set_smtp_ssl_mode(long mode) method for selecting the ssl mode
This commit is contained in:
parent
e822e13dc8
commit
bf386e2286
|
@ -86,6 +86,8 @@ Http & Http::begin()
|
||||||
smtp_from = nullptr;
|
smtp_from = nullptr;
|
||||||
username = nullptr;
|
username = nullptr;
|
||||||
password = nullptr;
|
password = nullptr;
|
||||||
|
force_smtp_ssl_mode = false;
|
||||||
|
smtp_ssl_mode = 0;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -195,6 +197,15 @@ Http & Http::add_recipient(const std::wstring & recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Http & Http::set_smtp_ssl_mode(long mode)
|
||||||
|
{
|
||||||
|
force_smtp_ssl_mode = true;
|
||||||
|
smtp_ssl_mode = mode;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Http & Http::add_headers(pt::Space * headers)
|
Http & Http::add_headers(pt::Space * headers)
|
||||||
{
|
{
|
||||||
additional_space_headers_to_send = headers;
|
additional_space_headers_to_send = headers;
|
||||||
|
@ -812,6 +823,12 @@ void Http::put_method(Method & method)
|
||||||
{
|
{
|
||||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, smtp_recipients);
|
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, smtp_recipients);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( force_smtp_ssl_mode )
|
||||||
|
{
|
||||||
|
curl_easy_setopt(curl, CURLOPT_USE_SSL, smtp_ssl_mode);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -272,6 +272,21 @@ public:
|
||||||
Http & add_recipient(const wchar_t * recipient);
|
Http & add_recipient(const wchar_t * recipient);
|
||||||
Http & add_recipient(const std::wstring & recipient);
|
Http & add_recipient(const std::wstring & recipient);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CURLUSESSL_NONE
|
||||||
|
* do not attempt to use SSL.
|
||||||
|
*
|
||||||
|
* CURLUSESSL_TRY
|
||||||
|
* Try using SSL, proceed as normal otherwise. Note that server may close the connection if the negotiation does not succeed.
|
||||||
|
*
|
||||||
|
* CURLUSESSL_CONTROL
|
||||||
|
* Require SSL for the control connection or fail with CURLE_USE_SSL_FAILED.
|
||||||
|
*
|
||||||
|
* CURLUSESSL_ALL
|
||||||
|
* Require SSL for all communication or fail with CURLE_USE_SSL_FAILED. *
|
||||||
|
*/
|
||||||
|
Http & set_smtp_ssl_mode(long mode);
|
||||||
|
|
||||||
bool send_mail(const wchar_t * smtp_url, const wchar_t * from, const std::string & in, pt::WTextStream & out, bool clear_stream = true);
|
bool send_mail(const wchar_t * smtp_url, const wchar_t * from, const std::string & in, pt::WTextStream & out, bool clear_stream = true);
|
||||||
bool send_mail(const wchar_t * smtp_url, const wchar_t * from, pt::WTextStream & in, pt::WTextStream & out, bool clear_stream = true);
|
bool send_mail(const wchar_t * smtp_url, const wchar_t * from, pt::WTextStream & in, pt::WTextStream & out, bool clear_stream = true);
|
||||||
|
|
||||||
|
@ -321,6 +336,8 @@ private:
|
||||||
const wchar_t * smtp_from;
|
const wchar_t * smtp_from;
|
||||||
const wchar_t * username;
|
const wchar_t * username;
|
||||||
const wchar_t * password;
|
const wchar_t * password;
|
||||||
|
bool force_smtp_ssl_mode;
|
||||||
|
long smtp_ssl_mode;
|
||||||
|
|
||||||
std::wstring temp_header;
|
std::wstring temp_header;
|
||||||
std::string temp_header_ascii;
|
std::string temp_header_ascii;
|
||||||
|
|
Loading…
Reference in New Issue