# Net talk email Oauth2 Step by Step for outlook, Code for Gmail. Yahoo not working!

**URL:** <https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870>\
**Category:** uncategorized\
**Created:** [January 28, 2025, 4:14pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870 "2025-01-28T16:14:37Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [May 13, 2025, 2:27pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/21 "2025-05-13T14:27:46Z")

</div>

Depends on the service, but generally speaking, no.  
Your program will still call oAuthLogin to get the token (as it always does.)  
If the current token is valid, that is returned.

If it has expired then it should get another token automatically (with no user intervention).

After some period of time (depends on the service provider) they will need to manually do the OAuth login again. This could be once a year, or never - it’s completely dependent on the service provider.

Cheers  
Bruce

---

<div class="post-metadata">

**Author:** ![JeffH](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JeffH](https://clarionhub.com/u/JeffH)\
**Post date:** [May 13, 2025, 2:39pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/22 "2025-05-13T14:39:30Z")

</div>

Fantastic! I’m happy you got it working

---

<div class="post-metadata">

**Author:** ![Ankit\_Purohit](https://clarionhub.com/user_avatar/clarionhub.com/ankit_purohit/32/5745_2.png) [@Ankit\_Purohit](https://clarionhub.com/u/Ankit_Purohit)\
**Post date:** [June 3, 2025, 1:36pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/23 "2025-06-03T13:36:22Z")

</div>

Hi I’m new to clarion and using clarion8 version I want to implement OAuth ,I have Microsoft credentials (client Id ,Client Sec etc) now i refer this post and tried myself but not able to retrieve token. error is OAuthLogin is undefined.

---

<div class="post-metadata">

**Author:** ![JeffH](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JeffH](https://clarionhub.com/u/JeffH)\
**Post date:** [June 3, 2025, 3:05pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/24 "2025-06-03T15:05:00Z")

</div>

Welcome to the community. It has been a very long time since clarion8 was released but I am not sure that would make a difference. Additionally I am not sure how you are sending email. I use Nettalk and I am on a rather current version. Could you provide more details. Most often the mistake is getting the proper key and secret. The site was very confusing and I grabbed the wrong details. Did you import and compile the program provided above?

---

<div class="post-metadata">

**Author:** ![Ankit\_Purohit](https://clarionhub.com/user_avatar/clarionhub.com/ankit_purohit/32/5745_2.png) [@Ankit\_Purohit](https://clarionhub.com/u/Ankit_Purohit)\
**Post date:** [June 4, 2025, 5:40am UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/25 "2025-06-04T05:40:19Z")

</div>

Hi JeffH Im using NetTalk 11 version for sending mail below is the code.

IF ~CLIP(MyServer)  
MESSAGE(‘There has been no SMTP mail server specified!’,‘Invalid Mail Server’,ICON:HAND)  
!SELECT(?MyServer)  
CYCLE  
END  
IF ccSender = TRUE  
IF CLIP(MyCC)  
MyCC = CLIP(MyCC) & '; ’ & CLIP(MyFrom)  
ELSE  
MyCC = CLIP(MyFrom)  
END  
END

ThisEmailSend.Server = MyServer  
ThisEmailSend.Port = EmailPort !25  
ThisEmailSend.ToList = MyTo  
ThisEmailSend.ccList = MyCC  
ThisEmailSend.bccList = ‘’  
ThisEmailSend.From = MyFrom  
ThisEmailSend.Helo = MyHelo  
ThisEmailSend.Subject = MySubject  
IF CLIP(AttachedFileList) !‘D:\Temp\TestReadme.txt’ ! Could be ‘c:\test.txt’  
ThisEmailSend.AttachmentList = AttachedFileList !‘D:\Temp\TestReadme.txt’ ! Could be ‘c:\test.txt’  
END  
!ThisEmailSend.SetRequiredMessageSize (0, LEN(CLIP(MyText)), LEN(CLIP(MyHTML)))  
IF UseAuth = TRUE AND CLIP(UserAuthName) \<\> ‘’  
ThisEmailSend.AuthUser = UserAuthName  
ThisEmailSend.AuthPassword = UserAuthPassword ! Case Sensitive  
END  
!-----------------------------------------------------------------------  
IF UseSSL  
ThisEmailSend.SSL = 1 ! Set to 1 to use SSL  
END  
IF UseTLS !CLIP(UPPER(ORG:szEmailServer)) = ‘’  
ThisEmailSend.SecureEmailStartTLS = 1 ! Set to 1 to use StartTLS  
END  
IF ThisEmailSend.SSL OR ThisEmailSend.SecureEmailStartTLS  
ThisEmailSend.SSLCertificateOptions.CertificateFile = ‘’ !CertificateFile  
ThisEmailSend.SSLCertificateOptions.PrivateKeyFile = ‘’ !PrivateKeyFile  
ThisEmailSend.SSLCertificateOptions.DontVerifyRemoteCertificateWithCARoot = TRUE  
ThisEmailSend.SSLCertificateOptions.DontVerifyRemoteCertificateCommonName = TRUE  
ThisEmailSend.SSLCertificateOptions.CARootFile = ‘’ !CARootFile  
END  
!End of use SSL/TLS  
!-----------------------------------------------------------------------  
!You must call this function  
!before populating self.MesageText  
IF ThisEmailSend.Error = 0 ! Check for error  
ThisEmailSend.MessageTextST.SetValue(CLIP(MyText))  
IF LEN(CLIP(MyHTML)) \> 0  
ThisEmailSend.MessageHTMLST.SetValue(CLIP(MyHTML))  
END  
SETCURSOR(CURSOR:WAIT)  
DISPLAY()  
ThisEmailSend.SendMail(NET:EMailMadeFromPartsMode) ! Put email in queue and start sending it

SETCURSOR()  
DISPLAY()  
ELSE  
CYCLE  
END

for setting up microsoft credential  
! Get Passed Parameters…  
MyServer = pServer  
MyFrom = pFrom  
MyTo = pTo  
EmailPort = pPort  
AttachedFileList = pAttachmentList  
UserAuthName = pUserName  
UserAuthPassword = pUserPassword  
MyCC = pCCAddress  
UseSSL = pUseSSL  
UseTLS = pUseTLS  
UseAuth = pUseAuth  
IF ~EmailPort THEN EmailPort = 25.  
MyText = pMyText  
MySubject = pMySubject  
ErrFlag = FALSE

clear(OAuthParms)  
OAuthParms.pServiceName = ‘Microsoft’  
OAuthParms.pOAuthVersion = 2  
OAuthParms.pClientId = ‘_**’  
OAuthParms.pClientSecret = '**_’  
OAuthParms.pRedirectURL = ‘’  
!OAuthParms.pExternalBrowser = netOAuth:UseLocalBrowser  
!OAuthParms.pListenTLS = false  
!OAuthParms.pListenPort = 8123  
!OAuthParms.pListenBindIP = ‘127.0.0.1’  
OAuthParms.pScope = ‘’  
OAuthParms.pAuthorizeURL = ‘’  
OAuthParms.pAccessTokenURL = ‘’  
OAuthParms.pExpectedCertificateCommonName = ‘’

Result = OAuthLogin(OAuthParms)  
IF Result = NET:OK  
Token = OAuthParms.rToken  
DISPLAY(Token)  
END

---

<div class="post-metadata">

**Author:** ![JeffH](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JeffH](https://clarionhub.com/u/JeffH)\
**Post date:** [June 4, 2025, 7:04pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/26 "2025-06-04T19:04:06Z")

</div>

I am confused by the order of your code. May I recommend that you break down your code into smaller sections as routines. Then call the routines in order. Something like.

GetOauthParamsStep1 ROUTINE  
!Code for routine here

SendEMailRoutineStep2 ROUTINE  
!Code for routine here

Then call these routines as

DO GetOauthParamsStep1  
DO SendEMailRoutineStep2

I uploaded a zip file above that has a working example. It is in txa format and should import into C8. You can create a new solution from txa. The templates used are Chrome Explorer, Jfiles, NetTalk, Reflection and StringTheory. I honestly cant help with older versions here.

Oauth can be done without chrome explorer. When you import the routine you first would need to ignore the error about not having chrome explorer. Then change the code for pExternalBrowser to the proper property.

Oauth is more simple then it looks.

1. register with the provider and get a ID and Key. Be careful of what they call it. Make sure you follow every single step in my document above. You must not only provide information about who you are but you will in many cases need top tell the provider the scope/permissions that you want access for. For example. On your phone you may get asked for location access or access to your camera. These are all permissions/scopes. You will need to provide these scopes for email. Check offline\_access and Check SMTP.Send

2. Now you use the nettalk procedure to ask the provider using your key and id to give your software access to an email. This request is returned on the given ip and port. This will include the token and refresh token.

3. Send the email using the login email address and the refresh token

If you have trouble loading my txa then let me know. I honestly dont have a lot of time to examine all of your code.

Jeff

---

<div class="post-metadata">

**Author:** ![Ankit\_Purohit](https://clarionhub.com/user_avatar/clarionhub.com/ankit_purohit/32/5745_2.png) [@Ankit\_Purohit](https://clarionhub.com/u/Ankit_Purohit)\
**Post date:** [June 5, 2025, 5:48am UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/27 "2025-06-05T05:48:45Z")

</div>

Hi Jeff Thank you for providing steps but my question is we have a function here  
if OAuthLogin(OAuthParms) = net:Ok  
! login successful  
else  
! login failed  
end  
in which we are passing OAuthParams Should i mannualy create this or this function is provided by NetTalk if yes"**how to import this function(OAuthLogin) in my code** so that i can use it.

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [June 7, 2025, 4:02am UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/28 "2025-06-07T04:02:39Z")

</div>

Its a procedure in your app. Look in the NetTalk Oauth examples for it, and import rrom there.

From memory, theres also a button on the NetTalk Global extension to import it.

---

<div class="post-metadata">

**Author:** ![Koen](https://clarionhub.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@Koen](https://clarionhub.com/u/Koen)\
**Post date:** [February 26, 2026, 7:09pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/29 "2026-02-26T19:09:16Z")

</div>

I need to sent emails via Gmail. If I am correct this can be done with Nettalk en OAuth. Probably a lot of work with all the ClientSecretID’s and mixing them up etc.

But before I dive into this, two questions:

1. If I sent emails via a Gmail account, will the sent email end up in the sent items of that Gmail account?
2. How hard is it for a normal user to fill in all the needed credentials? Or don’t they nothing to know on ClientSecretID’s etc and is that a one time setting that only the developer mus do?

---

<div class="post-metadata">

**Author:** ![jobcard](https://clarionhub.com/user_avatar/clarionhub.com/jobcard/32/5223_2.png) [@jobcard](https://clarionhub.com/u/jobcard)\
**Post date:** [February 26, 2026, 10:45pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/30 "2026-02-26T22:45:25Z")

</div>

Hi Koen

1. Yes - if you send via Gmail’s smtp then the email is stored in Gmail’s sent folder
2. I’ve chosen to use Google’s _Sign in with app passwords_[Sign in with app passwords - Gmail Help](https://support.google.com/mail/answer/185833?hl=en)

My users don’t see the email password when sending - I’m using a separate app (not Nettalk) to send emails that runs as a service (Capesoft’s Self Service). The email password is encrypted using Cryptonite.

Cheers  
Rohan

---

<div class="post-metadata">

**Author:** ![Koen](https://clarionhub.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@Koen](https://clarionhub.com/u/Koen)\
**Post date:** [February 27, 2026, 1:40pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/31 "2026-02-27T13:40:17Z")

</div>

Hi Rohan,

1. Great.
2. Do I understand you correct that you only sign in to one Gmail account? SO it is you who created the app password?

If I understand my contractor right they want each user to use their own Gmail account. The article you pointed out that each user has to enter an app password themself. Might be a support issue 😕

What I am not sure if they standard accounts or Google workspace accounts. That seem also to make a difference.

So instead of using an app password is letting them sign in with their username/password maybe a betters approach. Is such a thing possible and then still let my application sent email?

---

<div class="post-metadata">

**Author:** ![jobcard](https://clarionhub.com/user_avatar/clarionhub.com/jobcard/32/5223_2.png) [@jobcard](https://clarionhub.com/u/jobcard)\
**Post date:** [February 27, 2026, 11:33pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/32 "2026-02-27T23:33:41Z")

</div>

Hi Koen,  
The standard users don’t get to choose the email address that’s used to send emails. The system admin can set up to 10 different email addresses to send from: e.g. Default, Invoices, Quotes etc etc.

Based on the type of email (e.g. invoice, quote…) the smtp module loads the different details for sending.

I guess I could use the same methodology for individuals. It seems a bit easier to manage and troubleshoot where the settings are effectively system wide.

The advantage of using the approach I have taken is that the system admin controls the storage of emails by choosing which provider is storing or managing sent emails. I’ve taken an agnostic approach in that you can choose whichever provider you like, Google, Microsoft, Namecheap, Smtp2Go, your own mail server etc etc.

I also give them the option to store sent emails in an “archive” which is just an SQLite database (this is useful if you choose a provider such as Smtp2Go). The admin settings allow them to send a blind copy of every email to a nominated email address if they require it (which is something a client did request). They also have an option to set the _reply to_ email address within the admin settings e.g. Invoices reply to accounts, Quotes reply to sales etc etc

I think personal Gmail accounts can create app passwords as well as Google Workspace - Google does require that the user have 2fa turned on (that applies for Personal and Workspace) if you want to use app passwords.

At this stage I don’t provide any Oauth2 capabilities - not to say I won’t in the future if there is demand for it.

It really comes down to what you and your client agree works best for them.

Cheers  
Rohan

---

<div class="post-metadata">

**Author:** ![Koen](https://clarionhub.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@Koen](https://clarionhub.com/u/Koen)\
**Post date:** [February 28, 2026, 6:25pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/33 "2026-02-28T18:25:31Z")

</div>

Hi Rohan,

> [@jobcard](#):
>
> The standard users don’t get to choose the email address that’s used to send emails.

That is good solution. If only the administrator has to the job that will work.

For now I have enough information to get back to the contractor to ask for more information. Thank you for sharing you ideas.

---

<div class="post-metadata">

**Author:** ![JeffH](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JeffH](https://clarionhub.com/u/JeffH)\
**Post date:** [March 7, 2026, 3:20pm UTC](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870/34 "2026-03-07T15:20:54Z")

</div>

I am late to this conversation. Please share the results of your investigations when you are able.

[Previous page](https://clarionhub.com/t/net-talk-email-oauth2-step-by-step-for-outlook-code-for-gmail-yahoo-not-working/7870.md?page=1)
