var mail_request = new CurlMailRequest(curl)
# Networks
-var response = mail_request.set_outgoing_server("smtps://smtp.example.org:465", "user@example.org", "mypassword")
+var response: nullable CurlResponse = mail_request.set_outgoing_server("smtps://smtp.example.org:465", "user@example.org", "mypassword")
if response isa CurlResponseFailed then
print "Error code : {response.error_code}"
print "Error msg : {response.error_msg}"
fun execute: CurlResponse is abstract
# Intern perform method, lowest level of request launching
- private fun perform: nullable CurlResponse
+ private fun perform: nullable CurlResponseFailed
do
if not self.curl.is_ok then return answer_failure(0, "Curl instance is not correctly initialized")
end
# Intern method with return a failed answer with given code and message
- private fun answer_failure(error_code: Int, error_msg: String): CurlResponse
+ private fun answer_failure(error_code: Int, error_msg: String): CurlResponseFailed
do
return new CurlResponseFailed(error_code, error_msg)
end
end
# Configure server host and user credentials if needed.
- fun set_outgoing_server(host: String, user: nullable String, pwd: nullable String):nullable CurlResponse
+ fun set_outgoing_server(host: String, user: nullable String, pwd: nullable String): nullable CurlResponseFailed
do
# Check Curl initialisation
if not self.curl.is_ok then return answer_failure(0, "Curl instance is not correctly initialized")