Search code examples
phpemailgoogle-apps-scriptgmail

Change some account settings when new e-mail received


I need to change one setting in my account on a web site each time when I receive email from the given address with a given text.
As I understand it should not be a big problem with Google Apps Scripts. I see it so:
1) Each time, when I receive email (gmail account) script checks the sender and whether it contains necessary text.
2) If so, than I call PHP script which logs in the site and changes the necessary setting (HTTPResponse ?).
I found few examples how to log in and post data with PHP, so I could create PHP script to do this and use some hosting for it. This file will be than called from google scripts.

Is it possible to implement this task in this way?
Can I do all with google scripts without creating external php script?
I am new to google scripts (and don't have big experience in scripting), could you give me some examples, which I could use to implement such a task.


Solution

  • I am new to google scripts (and don't have big experience in scripting), could you give me some examples

    Here are couple of App Scripts reads to get you started:

    Since you mentioned about REST calls, checkout URL Fetch Service in App Script. This service allows scripts to access other resources on the web by fetching URLs. A script can use the UrlFetch service to issue HTTP and HTTPS requests and receive responses. The UrlFetch service uses Google's network infrastructure for efficiency and scaling purposes.

    Each of those guides has a Sample page you can check.