1

I am creating chrome extension for gmail, I want send a mail when user click a button created by my extension. I am using inboxsdk for creating extension.

I am creating button using following code

InboxSDK.load('1', '**************').then(function(sdk){ // the SDK has been loaded, now do something with it! sdk.Compose.registerComposeViewHandler(function(composeView){ // a compose view has come into existence, do something with it! composeView.addButton({ title: "button-title-goes", iconUrl: 'https://image.ibb.co/mXS2ZU/images.png', onClick: function(event) { console.log( event ); event.composeView.insertHTMLIntoBodyAtCursor('<img src="https://image.ibb.co/mXS2ZU/images.png" alt="Smiley face" height="1" width="1">'); }, }); }); }); 

I want to send mail when user click on this button.

3
  • Have you checked this SO post? Commented Oct 16, 2018 at 7:25
  • Yes, but no use from that SO post. Commented Oct 20, 2018 at 15:00
  • 1
    You can try send(sendOptions) method of the ComposeView class of InboxSDK. The doc describes the above method as Simulates clicking the compose's send button.. Here is the link to it. Commented Oct 23, 2018 at 12:36

1 Answer 1

3

Use the compose views send() function like follows.

sdk.Compose.registerComposeViewHandler(function(composeView){ composeView.addButton({ title: "button-title-goes", iconUrl: 'https://image.ibb.co/mXS2ZU/images.png', onClick: function(event) { console.log( event ); event.composeView.insertHTMLIntoBodyAtCursor('<img src="https://image.ibb.co/mXS2ZU/images.png" alt="Smiley face" height="1" width="1">'); composeView.send(); }, }); }); 

You can even hand over an optional configuration object which allows you to send and archive. InboxSDK - ComposeView

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.