Explore ↓
Send Email to Kindle via Google Sheets
Using Apps Script here is the code to send from gmail to Kindle. You can use a trigger to automate this daily or weekly.
// send it to username@kindle.com with Convert as the subject line
// ensure that your sending email approved in your Amazon Personal Document Settings
// Also set up Services on the left of apps script for Gmail API.
function sendEmailToKindle() {
const sender = "Enter email of newsletter"
const kindleEmail = "Enter your kindle's Email"
const labelName = "Enter any label you want"
let label = GmailApp.getUserLabelByName(labelName)
const threads = GmailApp.search(`from:${sender} -label:"${labelName}`,0,1)
if (threads.length === 0){
Logger.log("No Emails Found")
return}
const thread = threads[0]
const message = thread.getMessages().pop()
const subject = message.getSubject()
const body = message.getBody()
const html = `<html><body>${body}</body></html>`
const blob = Utilities.newBlob(html,"text/html")
.getAs("application/pdf").setName(subject + ".pdf")
MailApp.sendEmail({
to: kindleEmail,
subject: "convert",
body: " ",
attachments: [blob],
name: "Kindle Sender"
})
thread.addLabel(label)
thread.moveToArchive()
Logger.log(`Sent ${subject} to Kindle!`)
}