Hi Team,
I am using Gmail api in Angular 9, After authenticate, when i send email
first time its not sending the email, once i refresh the page then only the
email sending correctly.
My code snippet, if anything wrong please reply. Thanks in Advance
gapi.load('client:auth2', () => {gapi.client.load('gmail', 'v1', () => {
gapi.client.setToken({ access_token: localStorage.getItem('accessToken')
}); gapi.client.init({ Key: this.apiKey, discoveryDocs:
['https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest'], client_id:
this.clientId, immediate: true,
scope:'https://www.googleapis.com/auth/gmail.send' }).then(res => { return
gapi.client.gmail.users.messages.send({ userId: this.useremail, resource: {
raw:btoa(message).replace(/\+/g, '-').replace(/\//g, '_'), } }).then(res =>
{ var returnbody=JSON.parse(res.body); }); }) }); });
Regards,
Ramji
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/574b86d6-140e-422f-ad20-4e022d177869n%40googlegroups.com.