Paco,
A ver, yo estoy usando este ejemplo desde modHarbour usando cuenta con doble validacion y funciona correctamente.
<div class="php" id="{CB}" style="font-family: monospace;">#include "hbcurl.ch"
function main()
local hCredentials := { "type" => "gmail", "user" => "mi-user@gmail.com", "key" => "mi_token_de_seguridad_gmail" }
? 'SEND', Send_Gmail( hCredentials[ 'user' ], hCredentials[ 'key' ], 'Charly', <!-- e --><a href="mailto:'charly@su-mail.com">'charly@su-mail.com</a><!-- e -->', 'Test...', 'Hola...' )
retu nil
//----------------------------------------------------------------------------//
function Send_Gmail( cUser_From, cKey, cTo_Alias, cTo_Address, cTitle, cMsg )
local d := <a href="http://www.php.net/date">date</a>()
local cDate := CDow(d) + ', ' + <a href="http://www.php.net/ltrim">ltrim</a>(str(day(d))) + ' ' + cMonth(d) + ' ' + <a href="http://www.php.net/ltrim">ltrim</a>(str(year(d))) + ' ' + <a href="http://www.php.net/time">time</a>()
local cTempFile := TempFile( hb_getenv( 'PRGPATH' ) + '/data' , 'txt' )
LOCAL hCurl, uValue, nHandle, cTxt
// "Date: Tue, 3 Feb 2021 20:40:16" + CRLF + CRLF +;
<a href="http://www.php.net/if">if</a> ! empty( hCurl := curl_easy_init() )
cTxt := "From: Chatbour <" + cUser_From + ">" + CRLF +;
"To: " + cTo_Alias + " <" + Alltrim( cTo_Address) + ">" + CRLF+;
"Subject: " + cTitle + CRLF +;
"Date: " + cDate + CRLF + CRLF +;
cMsg
nHandle := Fcreate(cTempFile)
Fwrite(nHandle,cTxt )
<a href="http://www.php.net/fclose">FClose</a>(nHandle)
curl_easy_setopt(hCurl, HB_CURLOPT_USE_SSL, HB_CURLUSESSL_TRY )
curl_easy_setopt(hCurl, HB_CURLOPT_UPLOAD )
curl_easy_setopt(hCurl, HB_CURLOPT_USERNAME, cUser_From )
curl_easy_setopt(hCurl, HB_CURLOPT_PASSWORD, cKey )
curl_easy_setopt(hCurl, HB_CURLOPT_URL, "smtps://smtp.gmail.com:465")
curl_easy_setopt(hCurl, HB_CURLOPT_PROTOCOLS, hb_bitOr( HB_CURLPROTO_SMTPS, HB_CURLPROTO_SMTP ) )
curl_easy_setopt(hCurl, HB_CURLOPT_TIMEOUT_MS, 5000 )
curl_easy_setopt(hCurl, HB_CURLOPT_FOLLOWLOCATION, 1)
curl_easy_setopt(hCurl, HB_CURLOPT_SSL_VERIFYPEER, 0)
curl_easy_setopt(hCurl, HB_CURLOPT_MAIL_FROM, cUser_From )
curl_easy_setopt(hCurl, HB_CURLOPT_MAIL_RCPT, { cTo_Address })
curl_easy_setopt(hCurl, HB_CURLOPT_VERBOSE, 0)
curl_easy_setopt(hCurl, HB_CURLOPT_UPLOAD, 1)
curl_easy_setopt(hCurl, HB_CURLOPT_UL_FILE_SETUP, cTempFile )
<a href="http://www.php.net/if">IF</a> (nret:=curl_easy_perform( hCurl )) == 0
uValue := nret
<a href="http://www.php.net/else">ELSE</a>
uValue := nret
<a href="http://www.php.net/endif">ENDIF</a>
<a href="http://www.php.net/endif">ENDIF</a>
fErase( cTempFile )
curl_easy_cleanup( hCurl )
<a href="http://www.php.net/return">RETURN</a> uValue
//----------------------------------------------------------------------------//</div>
No lo he compilado con FWH porque ahora no lo uso, pero deberia funcionar si o si. Solo deberias cambiar la linea de definicion de cTempFile y adaptarla a vuestra manera. Y no olvidaros de parametrizar vuestra cuenta de gmail a doble verificacion y opbtener la key.
Saludos.
C.