Hi John, Thanks for you answer, which led me to the correct configuration. It was all about the "subject" missing from my way of implementing the Service ; as the function gmail.New() is deprecated, gmail.NewService() is to be used instead...but it does not implement - yet - the "subject" prop.
A discussion is still opened to fix this lack of code: https://github.com/googleapis/google-api-go-client/issues/379 This describes exactly the code you sent me (btw, I don't know I received your answers by mail but they are not displayed here on groups.google.com)...which is working like a charm. Thanks a lot again, Le vendredi 24 juillet 2020 à 22:54:33 UTC+2, Vincent Jouglard a écrit : > Hi John, > > Thanks for your message. > The main difference with my implementation is that I use a service account > which is authorized to send messages on my behalf...and I think that this > is where lies the problem. > > As i understand OAuth and the implementation from your exemple, a token is > generated and could (will) need to be refreshed, requiring a human > interaction (copy past a token from a UrL). Using a service account allows > a full server-to-server flow. > Please correct me if I am mistaken! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d6c5e13b-3a7e-4303-904d-14e37ad24c06n%40googlegroups.com.