Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get the email adress of the sender
    primarykey
    data
    text
    <p>I need to generate a report on the list of messages and the sender of a letter, I can extract the theme of letters, but not understanding how to get the sender's address for each letter, the report turned out to be:</p> <p>topic: hello From: frank@gmail.com</p> <p>topic: your basket from: jerry@facebook.com </p> <pre><code> function myFunction() { var emailAddress = Session.getActiveUser().getEmail(); var threads = GmailApp.getInboxThreads(); var output = ContentService.createTextOutput(); for (var i = 0; i &lt; threads.length; i++) { output.append(threads[i].getFirstMessageSubject()+" from:"+'\n'); } GmailApp.sendEmail(emailAddress,"Mail Report", output.getContent() ); } </code></pre> <p><strong>UPDATE</strong></p> <p>Thank you for your answers, the solution was simple</p> <pre><code> function myFunction() { var emailAddress = "example@email.com" ; var threads = GmailApp.getInboxThreads(); var messages = threads[0].getMessages(); var senderEmail = messages[0].getFrom(); var output = ContentService.createTextOutput(); for (var i = 0; i &lt; threads.length; i++) { messages = threads[i].getMessages() senderEmail = messages[0].getFrom(); output.append(i + ". " + threads[i].getFirstMessageSubject()+" from:"+ senderEmail + '\n'); } GmailApp.sendEmail(emailAddress,"Mail Report", output.getContent() ); } </code></pre> <p>Example result:</p> <ol> <li>Email Verification - Stack Overflow from:Stack Overflow </li> <li>Project Update #10: Double Fine Adventure by Double Fine and 2 Player Productions from:Kickstarter </li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload