 <p>As Henrique said, you just need to call the function you made as below</p> <pre><code> function sendEmail() { var firstThread = GmailApp.getInboxThreads(0,1)[0]; var message = firstThread.getMessages()[0]; var sender = message.getFrom(); var body = "Detta mail är ursprungligen skickat från" + " " + sender + '\n' + message.getBody(); var subject = message.getSubject(); var attachment = message.getAttachments(); GmailApp.sendEmail("user.name@adje.com", subject, "", {htmlBody: body, attachments: attachment}); Logger.log(body); markArchivedAsRead(); } function markArchivedAsRead() { var threads = GmailApp.search('label:unread -label:inbox'); GmailApp.markThreadsRead(threads); }; </code></pre>