问题
I am able to fetch and email the img2 but when I tried a shared-with-everyone image the below failsvand the email shows only empty box. What is gong on? TIA.
function sendEmail() {
// var img2 = "https://upload.wikimedia.org/wikipedia/commons/3/38/JPEG_example_JPG_RIP_001.jpg"
var img = "https://drive.google.com/open?id=19JSe5jLnlllnUoYZlimeWAC39qLXwWs-"
var subject = "Subject";
var msgBody = "Body";
var imgFetch = UrlFetchApp
.fetch(img2)
.getBlob()
.setName("imgFetch");
msgBody = "<img src='cid:thisImg' style='width:100px; height:70px;' />";
MailApp.sendEmail(mail, subject, "",
{ htmlBody: msgBody + "<BR/><BR/>",
inlineImages:
{
thisImg: imgFetch,
}
});
}
回答1:
How about this modification? In this modification, the endpoint was modified.
From:
var img = "https://drive.google.com/open?id=19JSe5jLnlllnUoYZlimeWAC39qLXwWs-"
To:
var img = "https://drive.google.com/uc?id=19JSe5jLnlllnUoYZlimeWAC39qLXwWs-"
来源:https://stackoverflow.com/questions/55754450/cannot-fetch-shared-google-drive-link-anyone-using-apps-script-urlfetchapp