Can someone guide me how to send mail using google rest api.
I try with
Long ll_rtn
HttpClient lhc_Client
lhc_Client = Create HttpClient
CoderObject lco_code
lco_code = Create CoderObject
string ls_url
//ls_Url = "https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=media"
ls_Url = "https://www.googleapis.com/upload/gmail/v1/users/me/messages/send"
lhc_Client.SetRequestHeader ( "Content-Type", "message/rfc822" )
lhc_Client.SetRequestHeader ( "Accept", "application/json" )
//lhc_Client.SetRequestHeader ( "Content-Type", "application/json" )
lhc_Client.SetRequestHeader("Authorization", "Bearer ya29.a0AfH6SMCke-UZmdOuGq14PK6iNP3yFRM0c0f_WaDI0giDApe_YHHapJUFDxu8Aeks_-vYo6984SX0Z-OfAP8jrrqqmwyM7B-guDh1CYp1vJKyzq8nCEGrhvNYpf8z1BMNfvg9o1h1VUvjSbCq_x48WosKinAao_9O7As")
Blob lblb_data
String ls_Base64Str, ls_postdata, ls_Body
string ls_email_data
ls_email_data = "From: from@gmail.com\r\n" + "To: to@gmail.com\r\n" + "Date:Fri, 21 Nov 1997 09:55:06 -0600\r\n" + "Subject:Subject Text\r\n\r\n" + "The message text goes here"
lblb_data = Blob(ls_email_data)
CoderObject lnv_CoderObject
lnv_CoderObject = Create CoderObject
ls_Base64Str = lnv_CoderObject.Base64UrlEncode(lblb_data)
ls_postdata = '{"raw": "' + ls_Base64Str + '"}'
ll_rtn = lhc_Client.sendrequest( "POST", ls_Url , ls_postdata)
If ll_rtn = 1 And lhc_Client.getresponsestatuscode( ) = 200 Then
ll_rtn = lhc_Client.GetResponsebody( ls_Body)
Else
MessageBox ( "", lhc_Client.getresponsestatusText( ) )
End If
If IsValid ( lhc_Client ) Then DesTroy ( lhc_Client )
If IsValid ( lco_code ) Then DesTroy ( lco_code )
but not success