Sending Gmail message through Apps Script does not show correct "from" name

329 views
Skip to first unread message

Josh Goldstein

unread,
Mar 16, 2022, 7:44:53 AM3/16/22
to Google Apps Script Community
Hi all,

I have a script that sends a Gmail message automatically, but for some reason, recipients see only the Gmail address handle instead of the full name specified in the Gmail account.

For example, let's say the account's full name is "Firstname Lastname", with an email address of "myemailaddress[at]gmail.com." However, recipients of the messages from this account via Apps Script see only "myemailaddress" as the sender of the emails, instead of "Firstname Lastname." When sending emails not via Apps Script, the full name (Firstname Lastname) is shown as the sender's name, as expected.

Any ideas why this isn't working properly when the email is sent with Apps Script? I've verified the Gmail account has the correct name stored in the "Send emails as" field, so this should work as expected.

Thanks!

Martin Hawksey

unread,
Mar 16, 2022, 8:00:38 AM3/16/22
to Google Apps Script Community
Hi,

I'm guessing your question is related to the mail merge solution on the Google Developers website? There are some advance sending parameters you can use in the sample code I've highlighted here https://hawksey.info/blog/2020/04/a-bulk-email-mail-merge-with-gmail-and-google-sheets-solution-evolution-using-v8/#Advanced_Send_Parameters_cc_bcc_sender_namefrom_replyTo

[to use these parameters you'll need to uncomment them by removing the '//' at the start of the line]

Hope this helps and happy to answer any additional questions

Best
Martin   

Josh Goldstein

unread,
Mar 17, 2022, 10:25:02 PM3/17/22
to Google Apps Script Community
Oh, duh. Wow, the answer was right there in the commented-out code! Thanks so much for the helpful response.

Josh

Josh Goldstein

unread,
Mar 17, 2022, 10:25:35 PM3/17/22
to Google Apps Script Community
Oh, and thank you for the helpful sample in the first place! Huge win for the community.

Josh

Hasan Khan

unread,
Jan 26, 2023, 2:18:47 PM1/26/23
to Google Apps Script Community
Facing a similar issue. While uncommenting is a short-term fix, what causes the underlying problem in the first place? Is there a way to fix that?

Braydan Willrath [Personal]

unread,
Mar 27, 2024, 5:35:02 PMMar 27
to Google Apps Script Community
Hey Martin,

Is there a way to automatically pull the default senders name from Gmail/Google Workspace settings and use that?

I've got many volunteers that use this script for our charity, and they can do every step just fine, except when they see a bunch of code it just freaks them out.

Plus I feel like having any basic computer users edit lines of code in an Apps Script is asking for trouble.

Surely there is a way to pull and use this information automatically for the majority of use cases?
Reply all
Reply to author
Forward
0 new messages