Skip to content Skip to sidebar Skip to footer

Google App Script: Send Mail, Inlineimage From Js File

I use google.script.run to use the MailApp API in google app script and I pass a mail object like this : google.script.run.sendMail(mail); The mail object is structured like this

Solution 1:

FileObject is not a legal value.

Legal parameters and return values are JavaScript primitives like a + Number, + Boolean, + String, or + null, as well as + JavaScript objects and arrays that are composed of primitives, objects and arrays. + A form element within the page is also legal as a parameter, but it must be the function’s only parameter, and it is not legal as a return value

The only way you're going to get a file past through the above restrictions from client to server are if you convert the fileObject to one of the above types. I'll go with form:

If you call a server function with a form element as a parameter, the form becomes a single object with field names as keys and field values as values. The values are all converted to strings, except for the contents of file-input fields, which become Blob objects.

Post a Comment for "Google App Script: Send Mail, Inlineimage From Js File"