When I am sending mail through gmail service account using gmailapi it is showing the following error.
Errors [ Message[Precondition check failed.] Location[ - ] Reason[failedPrecondition] Domain[global] ] My Gmail service account is a free gmail account. Authentication with service account is working but send mail is not working and showing above error. Please suggest me how to resolve the issue. Here is code i am using to send mail
'''
MimeMessage email = createEmail(to, from, subject, body);// calling the createEmail Function to create the mail message
Message message = new Message();
message.Raw = StringToBase64url(email.ToString());
var sa1 = service.Users.Messages.Send(message, userId).Execute();
return sa1;'''