title: Is there a way to call the getAlias name in Google App Scripts?
body: <p>The issue is— emails are being sent from an alias [cs@example.com], and the name displayed in the inbox is cs (user), not the actual name— Example Support. </p>
  
  <p>A possible solution is of course using the options <code>GmailApp.sendEmail(recipient, subject, body, {from: alias[0], name: 'Example Support'})</code>, however, would there be a get option to keep it as a variable— like <code>getName</code>?</p>
  
  <p>This is a stripped down version of the current code which works, but isn't ideal(‍♀️):</p>
  
  <pre><code>function myFunction() {
  
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var lastrow = sheet.getLastRow();
    var sent = 'SENT';
  
    for (var i = 2;i&lt;=lastrow;i++){
  
      var email = sheet.getRange(i, 2).getValue();
      var subject = sheet.getRange(i, 3).getValue();
      var body = sheet.getRange(i, 4).getValue();
      var status = sheet.getRange(i, 5).getValue();
  
      var alias = GmailApp.getAliases();
      var support = alias[0];
      var accounting = alias[1];
      var name1 = 'Example Support';
      var name2 = 'Example Accounting';
  
      if (status == 'support') {
        GmailApp.sendEmail(email, subject, body, {from: support, name: name1});
        sheet.getRange(i, 7).setValue(sent); 
        SpreadsheetApp.flush
        } else if (status == 'accounting') {
          GmailApp.sendEmail(email, subject, body, {from: accounting, name: name2});
          sheet.getRange(i, 7).setValue(sent); 
          SpreadsheetApp.flush
          }
     }
  }
  </code></pre>
  
  <p>Would you know of a possibility? Thank you for your help!</p>