# Hello, I have problems sending email. Authentication method Use a OAUTH token

**URL:** <https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560>\
**Category:** Using my Dolibarr\
**Tags:** v20, Question, Help\
**Created:** [November 8, 2024, 12:29am UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560 "2024-11-08T00:29:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mstoluca](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mstoluca](https://www.dolibarr.org/forum/u/mstoluca)\
**Post date:** [November 8, 2024, 12:29am UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/1 "2024-11-08T00:29:39Z")

</div>

used Dolibarr 20.0.1

Hello, I have problems sending email.

Authentication method Use a OAUTH token

 ![Captura de pantalla 2024-11-07 a las 6.24.33 p. m.](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/b/bd3e02105dbd58a1bbef5b3826695b681f758580.png)

It already generates the token without problem annex photos

 ![Captura de pantalla 2024-11-07 a las 6.25.35 p. m.](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/6/61ff0de009b3d3bc391c24566f7bbf409e6a9f11.png)  
 ![Captura de pantalla 2024-11-07 a las 6.25.44 p. m.](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/a/af4a34ab102b0b7f3ae31e11fc2bccfd0c2e79fa.png)

but when sending email it shows an error

 ![Captura de pantalla 2024-11-07 a las 6.26.55 p. m.](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/2/277adb93ff98b136fc74f40674333f151758e69f.png)

I hope you can help me,

I already debugged and it is on this line

```
		$_retVal = $this->socket_send_str('AUTH XOAUTH2 '.base64_encode($initRes), '235');

```

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [November 8, 2024, 5:22am UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/2 "2024-11-08T05:22:56Z")

</div>

> [@mstoluca](#):
>
> used Dolibarr 20.0.1
> 
> * * *
> 
> Authentication method Use a OAUTH token

So do I. I had it working in 18.0.5 and then I’ve upgraded my container to 20.0.1

Some differences:

- I use google, not microsoft
- I reject self-signed certificates - so should you for security reasons

Looking at your error message, I notice that it says: `doli20.local` and that makes me wonder if Microsoft doesn’t want to talk to you because you don’t use a Fully Qualified Domain Name?

---

<div class="post-metadata">

**Author:** ![Plows](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/plows/32/5660_2.png) [@Plows](https://www.dolibarr.org/forum/u/Plows)\
**Post date:** [November 8, 2024, 9:36am UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/3 "2024-11-08T09:36:27Z")

</div>

Hi,  
try activating the last 2 scopes, i also have offline\_access.  
I have not enabled Allow selfsigned certificate.  
Your Token expired, ist it working!

---

<div class="post-metadata">

**Author:** ![mstoluca](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mstoluca](https://www.dolibarr.org/forum/u/mstoluca)\
**Post date:** [November 8, 2024, 5:00pm UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/4 "2024-11-08T17:00:29Z")

</div>

tengo otro desarrollo para poder traer los correos y task de. teams. y no me causa problemas

 ![Captura de pantalla 2024-11-08 a las 11.00.11 a. m.](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/2/255d6ae99565ca85d1dee26d22fb3f97f18bd111.jpeg)

---

<div class="post-metadata">

**Author:** ![mstoluca](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mstoluca](https://www.dolibarr.org/forum/u/mstoluca)\
**Post date:** [November 8, 2024, 5:01pm UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/5 "2024-11-08T17:01:07Z")

</div>

> [@Plows](#):
>
> Hi,  
> try activating the last 2 scopes, i also have offline\_access.  
> I have not enabled Allow selfsigned certificate.  
> Your Token expired, ist it working!

last 2 scopes. actrivated

---

<div class="post-metadata">

**Author:** ![Plows](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/plows/32/5660_2.png) [@Plows](https://www.dolibarr.org/forum/u/Plows)\
**Post date:** [November 9, 2024, 9:01am UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/6 "2024-11-09T09:01:38Z")

</div>

Hi,  
do you receive E-Mails?

---

<div class="post-metadata">

**Author:** ![mstoluca](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mstoluca](https://www.dolibarr.org/forum/u/mstoluca)\
**Post date:** [November 25, 2024, 10:38pm UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/7 "2024-11-25T22:38:48Z")

</div>

no, not receive emails

---

<div class="post-metadata">

**Author:** ![Plows](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/plows/32/5660_2.png) [@Plows](https://www.dolibarr.org/forum/u/Plows)\
**Post date:** [November 26, 2024, 5:55am UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/8 "2024-11-26T05:55:23Z")

</div>

Gold Morning,  
I am still a little confused about your token, because your redirect url doli20.local seems not valid, and your token is expired, do you have a screenshot with a token bot expired?  
Also try to get a valid url which directs to your doli installation.

---

<div class="post-metadata">

**Author:** ![mstoluca](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mstoluca](https://www.dolibarr.org/forum/u/mstoluca)\
**Post date:** [December 2, 2024, 11:55pm UTC](https://www.dolibarr.org/forum/t/hello-i-have-problems-sending-email-authentication-method-use-a-oauth-token/29560/9 "2024-12-02T23:55:28Z")

</div>

I use mamp pro. For this purpose it generates me. the certificate and everything necessary as if it were domain. That’s why I showed them that with an api that I generated separately it did bring me the emails to check the connection, BUT in the end I only need to send emails from Dolibarr with that exchage office 365 email. and it doesn’t stop there,

I have created the permissions correctly. coherence in azure etc
