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;
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
add a comment |
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
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
add a comment |
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
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
google-apps-script google-sheets
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
Thank you 🙏 Super clear answer
– saadya
Mar 27 at 14:11
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Thank you 🙏 Super clear answer
– saadya
Mar 27 at 14:11
add a comment |
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.
Thank you 🙏 Super clear answer
– saadya
Mar 27 at 14:11
add a comment |
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.
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.
answered Mar 27 at 8:55
KambwiliKambwili
586 bronze badges
586 bronze badges
Thank you 🙏 Super clear answer
– saadya
Mar 27 at 14:11
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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