i must download a lot of eMails (ca. 1000 pieces) from my GMail-Account to our fileser and have only access per Browser.
Here is my starting-script:
function myeMailExportToEML() {
var threads = GmailApp.search('Label:TestExportEML');
GmailApp.markThreadsRead(threads);
for (var i=0; i< threads.length; i++) {
var myID = threads[i].getId();
var mySubject = GmailApp.getMessageById(myID).getSubject();
??????????????????
??????????????????
??????????????????
}
}
Does anyone has a tipp for me?
Thanks
I found a solve:
function myExportToGoogleDrive1() {
var threads = GmailApp.search("label:TestExportEML");
GmailApp.markThreadsRead(threads);
Logger.log(threads)
var messagesArray = []
var newFolder = DriveApp.createFolder("dddddddddddddddddddddd").getId();
for (var i=0; i< threads.length; i++) {
var messages = threads[i].getMessages();
for (var j=0; j< messages.length; j++) {
var myID = messages[j].getId();
var msg = GmailApp.getMessageById(myID);
var msgRaw = msg.getRawContent();
var msgBlob = Utilities.newBlob(msgRaw, 'message/rfc822', 'example.eml');
var ssss = DriveApp.getFolderById(newFolder).createFile(msgBlob);
var filename = GmailApp.getMessageById(myID).getSubject();
ssss.setName(filename);
}
}
}
Thanks for your help.
Greetings