如何在Google Apps脚本中将一个网址重定向到另一个网址

时间:2017-11-21 06:37:23

标签: google-apps-script google-sheets

使用Google脚本用户通过图片接收电子邮件,用户点击我想要的图片后,会自动转到其他网址,例如(www.google.com) 我在谷歌脚本中使用了以下编码

function sendEmails()
{

var message    = GmailApp.getDraftMessages()[0];
var bodyText   = message.getBody();
var rawContent = message.getRawContent();
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2;
var  numRows = (sheet.getLastRow())-1; 
Logger.log(numRows);
var dataRange = sheet.getRange(startRow, 1, numRows, 5)
var data = dataRange.getValues();
Logger.log(data)
for (i in data)
{
var row = data[i];
var emailAddress =row[0];
var Name=row[1];
var googleLogoUrl = row[3];
var url = sheet.getRange("c"+i).getValue();
var googleLogoBlob = UrlFetchApp
                  .fetch(googleLogoUrl)
                   .getBlob()
                   .setName("Test");
   MailApp.sendEmail({
     to:test@example.com,
     subject: "test",
     htmlBody: "<img src='cid:googleLogo'> images! <br>",
     inlineImages:
       {
        googleLogo: googleLogoBlob,   
       }
       });
  }
}

0 个答案:

没有答案