XOAuth2AccessToken

Applies to

SMTPClient object

Description

Sets an XOAuth2 access token. The OAuth2 access token can also be set.

Usage

In scripts

The XOAuth2AccessToken property takes a string value.

Integer li_rc
SMTPClient  lnv_SmtpClient

lnv_SmtpClient = CREATE SMTPClient

//set the email message
lnv_SmtpClient.Message.SetSender("tester001.appeon@gmail.com","Tester001")
lnv_SmtpClient.Message.AddRecipient("tester002.appeon@gmail.com")
lnv_SmtpClient.Message.Subject = "SMTPClient Test Message"
lnv_SmtpClient.Message.TextBody = "SMTPClient example message body"

//set the email account information     
lnv_SmtpClient.Host = "smtp.gmail.com"
lnv_SmtpClient.Port = 587
lnv_SmtpClient.EnableTLS = True
lnv_SmtpClient.Username = "tester001.appeon@gmail.com"

//Model Authentication.
lnv_SmtpClient.XOAuth2AccessToken = "ya29.a0AVvZVsrZY8ra_fyIw3EyVSYUQIXYbWcz4_mYqlqtxFE-4t_hzLyV_BaZbaxhM3nC10Nr5Qm6hmHPBQvd5BfaH7kXN5KxS-XR0dnV-1EHltUJmcgBSZIHbPEkR6qLf_CEaEozOESSyebgAWv5SGynKfyCzsvR6QaCgYKAeMSARASFQGbdwaIy4ayfJPAa23BKltg4-AJjg0165"

//send the email
li_rc = lnv_SmtpClient.Send()

IF li_rc = 1 THEN
 Messagebox('SMTPClient','Mail sent successfully')
ELSE
 Messagebox('SMTPClient' ,'Email sending failed. Return ' + String(li_rc) + '.', StopSign!)
END IF

DESTROY lnv_SmtpClient

//Note: For more information about how to get the Access Token, refer to the TokenRequest object.