I've written a script that reads the date from a column in a spreadsheet in Google Sheets. It's separately attached to a trigger that runs daily. When the trigger runs, the date column is analyzed and compares the date to the current date to detect when it's 2 days out from date listed in the aforementioned column. For any matches, it pulls in other data from the same row(s) and generates an email for each row.
The trigger runs from a paid Google account since this script can send a lot of emails on any given day. The automation works perfectly fine.
However, I also have a use case where this same email needs to be manually triggered by users who work with this spreadsheet.
I have the script written to read the rows selected by the user, followed by allowing them to trigger the function under the macros. However, this causes the email generated by the script to be triggered from the active user, rather than through my paid account/email. Some users are using personal addresses, which causes a spoofing issue preventing email delivery in a series of instances.
How can I force the sender address to be from the paid account that's running the daily trigger, even in these scenarios where a user is manually triggering the macro/function?