Google Apps スクリプトで mandrill メール送信 API を使用したいと考えています。Google スクリプトでは、JSON コードを使用する必要がありますが、その使用方法がわかりません。私は Google アプリ スクリプトの初心者です。
var m = new mandrill.Mandrill('XXXXXXXXXXX');
var from_email = "user4@gmail.com";
var to = '[
{
"email": "recipient.email@example.com",
"name": "Recipient Name"
}
],';
// create a variable for the API call parameters
var params = {
"message": {
"from_email":from_email,
"to":[{"email":to}],
"subject": "Sending a text email from the Mandrill API",
"text": "I'm learning the Mandrill API at Codecademy, it's very difficult."
}
};
function sendTheMail() {
// Send the email!
alert('this is a mail script');
m.messages.send(params, function(res) {
log(res);
}, function(err) {
log(err);
});
}
Google Apps Script でこのコードを使用する方法がわかりません。