使用使用inboxsdk创建的自定义按钮发送邮件? [英] Send mail using custom button created using inboxsdk?

查看:128
本文介绍了使用使用inboxsdk创建的自定义按钮发送邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为gmail创建chrome扩展程序, 当用户单击由我的扩展程序创建的按钮时,我想发送邮件.我正在使用inboxsdk创建扩展.

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.

推荐答案

使用撰写视图send()函数,如下所示.

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();
        },
    });

});

您甚至可以移交一个可选的配置对象,该对象允许您发送和存档. InboxSDK-ComposeView

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

这篇关于使用使用inboxsdk创建的自定义按钮发送邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆