使用Google Apps脚本设置Sendinblue邮件服务

我正在尝试使用Google Apps脚本设置Sendinblue的邮件服务,如下所示:

code.gs

function sendInBlue(){ eval(UrlFetchApp.fetch('https://cdn.rawgit.com/mailin-api/mailin-api-node-js/master/V2.0/mailin.js').getContentText()); var client = new Mailin("https://api.sendinblue.com/v2.0","your access key"); data = { "to" : {"to@example.net":"to whom!"}, "from" : ["from@email.com", "from email!"], "subject" : "My subject", "html" : "This is the <h1>HTML</h1>" } client.send_email(data).on('complete',function(data){console.log(data);}); } 

错误消息: ReferenceError:“require”未定义。

sendinblue node.js库谈到一个Restler库也是必需的,但我真的不知道如何将这个库也纳入? 我是一个新手,所以可能完全偏离这里。

任何指导表示赞赏。

文档:

https://apidocs.sendinblue.com/tutorial-sending-transactional-email/

https://github.com/mailin-api/mailin-api-node-js/tree/master/V2.0

使用Sendinblue的邮件服务发送电子邮件的代码应该如下所示:

 function sendEmailWithSendInBlue() { var url = "https://api.sendinblue.com/v3/smtp/email"; var myAccessKey = "[enter your v3 access key]" var data = { "sender":{"name":"Name","email":"name@domain.com"}, "htmlContent":"this is the body", "subject":"subject", "replyTo":{"email":"name@domain.com","name":"Name"}, "to":[{"email":"name@domain.com","name":"Name"}] } var options = { 'method': 'post', 'contentType': 'application/json', 'payload': JSON.stringify(data), 'headers': {'api-key':myAccessKey}, }; var response = UrlFetchApp.fetch(url, options); Logger.log(response.getResponseCode()) }