You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var pathSecrets = @".\ContactosProject-dcbe8450d418.json";
var serviceAccountEmail = "contactosservice@contactosproject.iam.gserviceaccount.com";
var gmailSvc = GmailAPI.ServiceAccountHelper.AuthenticateServiceAccount(serviceAccountEmail, pathSecrets, Scopes);
string plainText = "To: xxxxxxxxxxx@gmail.com\r\n" +
"Subject: subject Test\r\n" +
"Content-Type: text/html; charset=us-ascii\r\n\r\n" +
"<h1>Body Test </h1>";
var newMsg = new Google.Apis.Gmail.v1.Data.Message();
newMsg.Raw = Base64UrlEncode(plainText.ToString());
gmailSvc.Users.Messages.Send(newMsg, "me").Execute();`
I use your AuthenticateServiceAccount class for samples.
I get the error:
Result StackTrace:
at Google.Apis.Requests.ClientServiceRequest1.<ParseResponse>d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Google.Apis.Requests.ClientServiceRequest1.Execute()
Service accounts will only work with Gsuite email accounts. The admin of the Gsuite (domain) account will have to grant the service account access to the users email account. Unfortunately i don't have access to a Gsuite account so cant help you set it up. This might help Perform G Suite Domain-Wide Delegation of Authority
If this is a normal Gmail user account you are trying to access then you cant use a service account. You will either have to go though the SMTP / IMAP servers or using Oauth2 to authenticate the user.
Then, any full sample step-by-step using Oauth2 to authenticate the user?
I have this code, using Service Account:
`
I use your AuthenticateServiceAccount class for samples.
I get the error:
The same error for
Any suggestions?
The text was updated successfully, but these errors were encountered: