Is there a way to call the getAlias name in Google App Scripts?Google Sheet script set cell valueHow to debug Google Apps Script (aka where does Logger.log log to?)Calling Google Spreadsheet functions from Google Apps ScriptsGoogle Script error -> Invalid email:myuser@mydomain.eduRetuning a GMail script to prevent “Exceeded maximum execution time”function to name range google app scriptGoogle Apps Script: update cell to file nameDoes the full header of the email taken from gmail inbox always contain a <return path> tag?Google Sheets to send email with text of cell that is enteredCall a Google App Script externally

How did Biff return to 2015 from 1955 without a lightning strike?

Can you remove a blindfold using the Telekinesis spell?

What parameters are to be considered when choosing a MOSFET?

Music Theory: Facts or Hierarchy of Opinions?

How to prevent a single-element caster from being useless against immune foes?

Can starter be used as an alternator?

How is char processed in math mode?

Balancing Humanoid fantasy races: Elves

Create and use Object Variable

Why are we moving in circles with a tandem kayak?

Can I shorten this filter, that finds disk sizes over 100G?

What is the term for completing a climbing route uncleanly?

Applications of pure mathematics in operations research

Reducing the time for rolling hash

Derivative is just speed of change?

Would people understand me speaking German all over Europe?

Betrayed by management at a new job, should I take action?

Was Donald Trump at ground zero helping out on 9-11?

how can I calculate confidence interval with small sample in R?

How to innovate in OR

What is the range of a Drunken Monk's Redirect attack?

UX writing: When to use "we"?

integration of absolute value

Introduction to the Sicilian



Is there a way to call the getAlias name in Google App Scripts?


Google Sheet script set cell valueHow to debug Google Apps Script (aka where does Logger.log log to?)Calling Google Spreadsheet functions from Google Apps ScriptsGoogle Script error -> Invalid email:myuser@mydomain.eduRetuning a GMail script to prevent “Exceeded maximum execution time”function to name range google app scriptGoogle Apps Script: update cell to file nameDoes the full header of the email taken from gmail inbox always contain a <return path> tag?Google Sheets to send email with text of cell that is enteredCall a Google App Script externally






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















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.



A possible solution is of course using the options GmailApp.sendEmail(recipient, subject, body, from: alias[0], name: 'Example Support'), however, would there be a get option to keep it as a variable— like getName?



This is a stripped down version of the current code which works, but isn't ideal(🤷‍♀️):



function myFunction() 

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastrow = sheet.getLastRow();
var sent = 'SENT';

for (var i = 2;i<=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





Would you know of a possibility? Thank you for your help!










share|improve this question
























  • Try using the Gmail API, specifically developers.google.com/gmail/api/v1/reference/users/settings/…

    – tehhowch
    Mar 27 at 3:08











  • @tehhowch Thanks, that's defenitely it

    – saadya
    Mar 27 at 14:13

















1















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.



A possible solution is of course using the options GmailApp.sendEmail(recipient, subject, body, from: alias[0], name: 'Example Support'), however, would there be a get option to keep it as a variable— like getName?



This is a stripped down version of the current code which works, but isn't ideal(🤷‍♀️):



function myFunction() 

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastrow = sheet.getLastRow();
var sent = 'SENT';

for (var i = 2;i<=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





Would you know of a possibility? Thank you for your help!










share|improve this question
























  • Try using the Gmail API, specifically developers.google.com/gmail/api/v1/reference/users/settings/…

    – tehhowch
    Mar 27 at 3:08











  • @tehhowch Thanks, that's defenitely it

    – saadya
    Mar 27 at 14:13













1












1








1








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.



A possible solution is of course using the options GmailApp.sendEmail(recipient, subject, body, from: alias[0], name: 'Example Support'), however, would there be a get option to keep it as a variable— like getName?



This is a stripped down version of the current code which works, but isn't ideal(🤷‍♀️):



function myFunction() 

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastrow = sheet.getLastRow();
var sent = 'SENT';

for (var i = 2;i<=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





Would you know of a possibility? Thank you for your help!










share|improve this question














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.



A possible solution is of course using the options GmailApp.sendEmail(recipient, subject, body, from: alias[0], name: 'Example Support'), however, would there be a get option to keep it as a variable— like getName?



This is a stripped down version of the current code which works, but isn't ideal(🤷‍♀️):



function myFunction() 

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastrow = sheet.getLastRow();
var sent = 'SENT';

for (var i = 2;i<=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





Would you know of a possibility? Thank you for your help!







google-apps-script google-sheets






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 22:43









saadyasaadya

156 bronze badges




156 bronze badges















  • Try using the Gmail API, specifically developers.google.com/gmail/api/v1/reference/users/settings/…

    – tehhowch
    Mar 27 at 3:08











  • @tehhowch Thanks, that's defenitely it

    – saadya
    Mar 27 at 14:13

















  • Try using the Gmail API, specifically developers.google.com/gmail/api/v1/reference/users/settings/…

    – tehhowch
    Mar 27 at 3:08











  • @tehhowch Thanks, that's defenitely it

    – saadya
    Mar 27 at 14:13
















Try using the Gmail API, specifically developers.google.com/gmail/api/v1/reference/users/settings/…

– tehhowch
Mar 27 at 3:08





Try using the Gmail API, specifically developers.google.com/gmail/api/v1/reference/users/settings/…

– tehhowch
Mar 27 at 3:08













@tehhowch Thanks, that's defenitely it

– saadya
Mar 27 at 14:13





@tehhowch Thanks, that's defenitely it

– saadya
Mar 27 at 14:13












1 Answer
1






active

oldest

votes


















0














That is only possible with the Gmail Advanced Google Services.



Important! First enable Gmail in Resources > Advanced Google Services. Then follow instructions for enabling the API in you script's GCP project.



To use your code as an example:



...
var support = alias[0]
...
if (status == 'support')
var aliasName = Gmail.Users.Settings.SendAs.get(me, support).displayName
GmailApp.sendEmail(email, subject, body, from: support, name: aliasName);
sheet.getRange(i, 7).setValue(sent);
SpreadsheetApp.flush



Adjust your other if statement similarly.






share|improve this answer

























  • Thank you 🙏 Super clear answer

    – saadya
    Mar 27 at 14:11











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367226%2fis-there-a-way-to-call-the-getalias-name-in-google-app-scripts%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














That is only possible with the Gmail Advanced Google Services.



Important! First enable Gmail in Resources > Advanced Google Services. Then follow instructions for enabling the API in you script's GCP project.



To use your code as an example:



...
var support = alias[0]
...
if (status == 'support')
var aliasName = Gmail.Users.Settings.SendAs.get(me, support).displayName
GmailApp.sendEmail(email, subject, body, from: support, name: aliasName);
sheet.getRange(i, 7).setValue(sent);
SpreadsheetApp.flush



Adjust your other if statement similarly.






share|improve this answer

























  • Thank you 🙏 Super clear answer

    – saadya
    Mar 27 at 14:11
















0














That is only possible with the Gmail Advanced Google Services.



Important! First enable Gmail in Resources > Advanced Google Services. Then follow instructions for enabling the API in you script's GCP project.



To use your code as an example:



...
var support = alias[0]
...
if (status == 'support')
var aliasName = Gmail.Users.Settings.SendAs.get(me, support).displayName
GmailApp.sendEmail(email, subject, body, from: support, name: aliasName);
sheet.getRange(i, 7).setValue(sent);
SpreadsheetApp.flush



Adjust your other if statement similarly.






share|improve this answer

























  • Thank you 🙏 Super clear answer

    – saadya
    Mar 27 at 14:11














0












0








0







That is only possible with the Gmail Advanced Google Services.



Important! First enable Gmail in Resources > Advanced Google Services. Then follow instructions for enabling the API in you script's GCP project.



To use your code as an example:



...
var support = alias[0]
...
if (status == 'support')
var aliasName = Gmail.Users.Settings.SendAs.get(me, support).displayName
GmailApp.sendEmail(email, subject, body, from: support, name: aliasName);
sheet.getRange(i, 7).setValue(sent);
SpreadsheetApp.flush



Adjust your other if statement similarly.






share|improve this answer













That is only possible with the Gmail Advanced Google Services.



Important! First enable Gmail in Resources > Advanced Google Services. Then follow instructions for enabling the API in you script's GCP project.



To use your code as an example:



...
var support = alias[0]
...
if (status == 'support')
var aliasName = Gmail.Users.Settings.SendAs.get(me, support).displayName
GmailApp.sendEmail(email, subject, body, from: support, name: aliasName);
sheet.getRange(i, 7).setValue(sent);
SpreadsheetApp.flush



Adjust your other if statement similarly.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 8:55









KambwiliKambwili

586 bronze badges




586 bronze badges















  • Thank you 🙏 Super clear answer

    – saadya
    Mar 27 at 14:11


















  • Thank you 🙏 Super clear answer

    – saadya
    Mar 27 at 14:11

















Thank you 🙏 Super clear answer

– saadya
Mar 27 at 14:11






Thank you 🙏 Super clear answer

– saadya
Mar 27 at 14:11







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367226%2fis-there-a-way-to-call-the-getalias-name-in-google-app-scripts%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript