0

I am always getting error while using inlineImages.

Error
Exception: Invalid argument: inlineImages"

Below is my code:

var blob = Charts.newTableChart()
  .setDataTable(table.build())
  .setDimensions(1000, 1000)
  .setOption("alternatingRowStyle", false)
  .build()
  .getBlob();
 
var resultingFile = DriveApp.createFile(blob);

var imagefileid=resultingFile.getId();
var ImageBlob = DriveApp
                      .getFileById(imagefileid)
                      .getBlob();

MailApp.sendEmail("[email protected]", orderno, '',htmlbody:"<img src=\"cid:sampleImage\">",inlineImages:ImageBlob});

Please suggest something for solution.

1 Answer 1

0

Try this:

MailApp.sendEmail("[email protected]", orderno, '',htmlbody:"<img src=\"cid:sampleImage\">",inlineImages:{sampleImage:ImageBlob});

  • inlineImages is an object that maps from an image key (String) to image data (BlobSource).
    • Objects are surrounded by curly brackets. Your code had the "closed curly bracket" (}) but the corresponding opening curly bracket was missing.
    • Also the object requires the key and the data. You had the data ImageBlob but not the image key (sampleImage)
    • "htmlbody" references the image key (sampleImage)

References

sendMail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.