i have a trouble with libcurl send email i try with this code and received “Send Failed: Login denied”, but with same credentials work with netttalk(last version), i need a solutions for clarion 6.3 apps, the vuMail 3.5 not work with sendgrid.net return this error “The transport failed to connect to the server” and need another tool compatible with clarion 6.3
EMailProvider = 'gmail'
CASE LOWER(EMailProvider)
OF 'gmail'
curl.Server('smtp.sendgrid.net', 587)
curl.Account('apikey', 'mypassword')
curl.From('myfrom')
curl.AddRecipient('myemail')
END
curl.useSSL(CURL_SSLVERSION_DEFAULT)
curl.setSSLVerifyPeer(False)
curl.setSSLVerifyHost(False)
curl.Subject('Test email')
curl.Body('Test email using libcurl')
curl.SetOpt(CURLOPT_CONNECTTIMEOUT, 30)
res = curl.Send()
IF res = CURLE_OK
MESSAGE('Email sent', 'SendMail', ICON:Asterisk)
ELSE
MESSAGE('Send failed: '& curl.StrError(res), 'SendMail', ICON:Exclamation)
END
Thanks for sharing that code. I’m trying to use TCurlMailClass, and that’s the library that’s giving me the error. But with smtp2go and Netttalk, I can make the connection. I’ll look into that solution.
curl.Server('smtp://smtp.sendgrid.net',587)
curl.Account('apikey', 'mykey)
curl.From('myfrom')
curl.AddRecipient('myemail')
curl.useSSL(CURL_SSLVERSION_DEFAULT)
curl.setSSLVerifyPeer(False)
curl.setSSLVerifyHost(False)
curl.Subject('Test email')
curl.Body('Test email using libcurl')
curl.SetOpt(CURLOPT_CONNECTTIMEOUT, 30)
res = curl.Send()
IF res = CURLE_OK
MESSAGE('Email sent', 'SendMail', ICON:Asterisk)
ELSE
MESSAGE('Send failed: '& curl.StrError(res), 'SendMail', ICON:Exclamation)
END
Seems this line is invalid: curl.useSSL(CURL_SSLVERSION_DEFAULT)
because useSSL method expects one of CURL_USESSL equates, for example CURLUSESSL_ALL; in your code CURL_SSLVERSION_DEFAULT is passed which is zero and therefore no SSL encryption is used. In fact, you call curl.useSSL(CURLUSESSL_NONE)