Force Mailapp to always send from specific email address? [closed] - email

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
The community is reviewing whether to reopen this question as of 1 year ago.
Improve this question
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?

MailApp hasn't a parameter to specify the sender, it always will use the email address of the effective user.
The active user is the user that that have opened the web app being used to run the function. The effective user might be different i.e. then a function has being executed by an installable trigger.
GmailApp allows to sent as the sender an email alias of the effective user. Another option is to use domain wide delegation of authority to impersonate a user from your domain.
Related
How to use the Gmail API, OAuth2 for Apps Script, and Domain-Wide Delegation to set email signatures for users in a G Suite domain
Resources
https://developers.google.com/apps-script/reference/gmail/
https://developers.google.com/apps-script/reference/mail/

If by "manual," you mean actually going into the editor and hitting run, there's not much that can be done for security reasons. However, if you deploy the app as a web app, it gives you an option in your deployment settings for users to execute as you (the paid account) or them.
Fig. 1
Fig. 2

Related

How can I trigger a contact workflow on a specific date in Bitrix24?

I would like to trigger a workflow resetting a sum on all contacts every 1st January of the year. The workflow is implemented. It could be triggered on the specific date or even everyday, because the date is verified in the workflow before resetting.
How can i run it on every contact?
Hello and welcome to Stackoverflow, the answer to your question is as the following:
You need to create a Rest API outbound webhook in your Bitrix account with "CRM" & "Business Process" permissions.
You will write down a PHP code that will be executed on the exact date/time of you choice
The PHP script will do 2 process:
Will retrieve all the contacts that you have on your Bitrix account and store them into a string value.
It will run that Business process and pass the list of all the found contacts, and inside your Business process you're going to set it up in a way that it will run the required actions on every contact from eh contacts IDs passed by the first step.
The PHP script can be hosted in a webhosting or even on your local machine since it's once a year.
This is only the concept of the solution, I can't share the script code because I don't have it at the moments, please contact me if you faces problems.

Sending Emails from different accounts with Google App Script

I have generated the codes with app script in order to send emails automatically if users changed some values in google spreadsheet, which is working fine.
Now I am sharing my google spreadsheet with the app script to two more person (e.g: PersonA, PersonB). Thus, I want whoever changes anything on google spreadsheet will be sending an email under his/her own account. E.g: [All of us needs to edit within the google spreadsheet itself, without going to the "current web app url", (thanks Cameron Roberts for the clarification] if PersonA changes anything, then an email will be sent out under PersonA's account, and an email will be sent out under PersonB's account if PersonB changes anything.
I did something based on the advice from user2970721 and Cameron Roberts. I adjusted "Deploy web App" as "User accessing the web app". e.g:
I also asked PersonA & PersonB to do the same under their accounts and made sure they have triggered the script at least once. e.g:
My issue is that after I have done all these mentioned above, no matter who changes anything on google spreadsheet, emails were always sent out from PersonB's account (my best guess is that I messed up something and PersonB was the last one who triggered the script).
Does the "Project version" need to be different for me, PersonA, and PersonB, or anything else I need to change? Any help would be greatly appreciated!
First, Your project versions do not need to be different for each user.
I'm assuming you are using the On Change event, rather than a web-app. If that's the case, you should disable the WebApp entirely, as it's not needed.
When PersonA creates an On Change trigger, that will be triggered anytime any user (eg PersonA or PersonB) edits the spreadsheet. When it is triggered the code will execute as PersonA , because PersonA created the trigger. As a result, the email will be sent from PersonA's account.
For the scenario you describe, where both PersonA and PersonB have created OnChange triggers and authorised the script. I would expect emails to be sent from both accounts that have created triggers.
To send only one email, from the account that did the edit, I think you would need to do a check to determine if the user who did the edit matches the user under who's authority the script is running. I've never done this before and the docs don't really make it clear if it's possible.
Try checking the User object (Eg e.user) included with the Change event, and see if that email address is reflecting the different users making the edits.
If it is, you can compare it with the effective user and send the email if they match.
https://developers.google.com/apps-script/reference/base/user
https://developers.google.com/apps-script/reference/base/session#getEffectiveUser()
Finally, it might be simpler to just include the address of the person making the edit in your email subject, and just have all the emails send from one account. That way you know who made the edit, but don't need to have every user create a trigger and do all the extra checking.

How to send confirmation email after submitting data using filemaker pro

I am very new to filemaker pro. Is there a way where I can get a conformation email after the user submits an entry using filemaker pro?
So for example, when the user clicks "Submit", it will automatically send me a confirmation email that says someone has submitted a form.
Yes, use the [Send Mail] script step. You can specify an SMTP server to use (which allows you to specify an account to use), or else use the locally connected user's email client (in which case the email will show as coming from the user)
Years ago we used the send mail step to send an alert to ourselves as outlined above. Over the years we moved away from this to a method we found more effective.
If your volume is consistent consider using FileMaker to report to you rather than emailing yourself. There is less to go wrong and you probably have to be in FileMaker to use the data.
Create a flag field set to "open" in the table that you check off when you've done what ever you will do with the information. Then create a calc field that shows how many open items you have.
For example we have an online store that uses FileMaker as a backend. The user screens have a field that appears as a little red ball with a number of open orders in it if there are unprocessed orders. If all the orders are processes the ball is green.

I need suggestions for something alternative to apple subscription? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
In my country apple does not support subscription, I can't make an app that can purchase monthly or period of time subscription, any alternatives?
Contact Apple and ask if this is a temporary or constant condition. If it's temporary, wait it out.
Otherwise, you can implement login screens and authentication mechanisms as you would have them in a WebApp. The latest Developer Agreements allow for this (as opposed to the previous agreements where you had to offer inAppPurchase as well). The caveat is that according to the agreement, you may not link to your 3rd party payment/signup site from within the app.
Set up payment processing with the provider of your choice (e.g. PayPal) and manage your own database of registered users. Then, when a user starts the app, ask them to log-in by supplying a username and password. Send those to your server (e.g. using a regular POST request), verify them and deliver the contents to the user if he is authenticated.
Make sure to keep the user logged in after that to avoid annoyance.
The main challenge with this approach will be to let users find out about your service in the first place as you are not allowed to openly send them over in the first place. Then again, if Apple doesn't offer the functionality in your country, you may be able to get through review with it.
In either case, contact Apple, then act accordingly.

What is the point of the Remember Me option on website logins? What is stopping developers from ALWAYS remembering the user? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Is it simply an artifact of the old fear (still around in some places) of cookies?
I also would like to know if it is bad practice to simply pass in user names from an outbound email.
Nothing is stopping the web app from always remembering the user for as long as they want on particular computer without asking explicit permission from the user. However, doing so has security and privacy implications on shared computers.
Imagine you go to a cyber-cafe or a library, sit on a shared computer and login to your bank website (which you shouldn't do from such places anyway :-)). The bank website tries to be "smart" and persists a cookie with a ticket based on your credentials. When you're done, you close the browser without logging off. Next person sits down, opens the browser, looks at the history and goes to the bank site. And now they have magically access to all your money.
That would probably be the last time you use that bank for anything.
Update: To answer the second part of the question (and the comment below)
If you are afraid of URL injection, you should probably not specify the username in the email URL itself. Instead, generate a one-time token (you could use a one-way hash of the user name and a website secret for example), which wouldn't mean anything to an external site, but would allow you to extract the user identity and prepopulate the field on the page.
Keep in mind that you should not include in the URL in the email enough information, so that clicking on that link would authenticate the user to your site. You still want the user to prove their identity.