小编emi*_*lal的帖子

使用Node.js的SendGrid模板中的变量替换不起作用

在SendGrids上使用USE案例之后,github确实设法向我发送了带有正确模板的电子邮件,但是替换显然不起作用,并且在生成的电子邮件中留为空白。服务器端:

const sgmailer = require("@sendgrid/mail");
sgmailer.setApiKey(process.env.SENDGRID_API_KEY);
sgmailer.setSubstitutionWrappers('{{', '}}');

const msg = {
    to: '...',
    from: 'sender@example.org',
    subject: 'Hello world',
    text: 'Hello plain world!',
    html: '<p>Hello HTML world!</p>',
    templateId: '...',
    substitutions: {
        name: 'Some One',
        city: 'Denver',
    },
};
sgmailer.send(msg)
Run Code Online (Sandbox Code Playgroud)

模板中的HTML:

const sgmailer = require("@sendgrid/mail");
sgmailer.setApiKey(process.env.SENDGRID_API_KEY);
sgmailer.setSubstitutionWrappers('{{', '}}');

const msg = {
    to: '...',
    from: 'sender@example.org',
    subject: 'Hello world',
    text: 'Hello plain world!',
    html: '<p>Hello HTML world!</p>',
    templateId: '...',
    substitutions: {
        name: 'Some One',
        city: 'Denver',
    },
};
sgmailer.send(msg) …
Run Code Online (Sandbox Code Playgroud)

javascript node.js sendgrid-api-v3 sendgrid-templates

1
推荐指数
1
解决办法
823
查看次数

react-select模块找不到反应

React-select找不到React:TypeError:React is undefined1 react-select.js:826:4

React-select.js正在做出反应

var React = (window.React);
Run Code Online (Sandbox Code Playgroud)

看起来我必须在html中包含React以使其工作,但我想避免这种情况.有什么我想念的吗?

(使用节点)

node.js reactjs react-select

-4
推荐指数
1
解决办法
659
查看次数