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

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?