Build CLI script to fetch personal Gmail account

Job ID: 33764418

Budget: $30 – $250 USD

I'm willing to pay $100 for this. I am a developer. I need an in-house use only command line tool built to fetch my personal Gmail.

While PHP is preferred, you may code your app in any language that works, or even use a tool.

It should fetch my personal Gmail, and send the data via HTTP to an API on my server.

Context:
I have a WordPress site that sends Gmail email via the Google API. I want to process the email responses on my server.
That is, currently when my gmail account receives an email, it ends up in my Gmail inbox. I need those emails in my database on my server somehow.

I am a developer, but I do NOT want to learn the Google API. Here is the documentation for PHP:
https://developers.google.com/docs/api/quickstart/php
https://github.com/googleapis/google-api-php-client

I want a command line tool that fetches new emails from my gmail account. Preferably in PHP, but you can use any language that will run on my AWS Ubuntu server.

The output of your tool should go to this API, in JSON, so you can just cUrl from your application to this url:

https://mysite.com/wp-json/incoming-email/

HTTPS Post Body:
email_from - the email of the gmail item sender
email_subject - the subject of the gmail item
email_body - the text body of the gmail item. We do not need attachments or binaries
secret_key - will be provided. A secret key must be provided so that the API accepts your app's output.

Your app should run via the command line, either on a cron or more likely by running it with a command. Like [if your app was PHP]:

ubuntu/$ php yourapp.php

It should fetch some default number of new gmails.
It should mark the gmails as "read".
After fetch, it should send the data to the custom API via cUrl.

The server is registered with Google, and the domain is currently SENDING gmails with no problem. I'm using this plugin to send Gmails, which registers a Google API key:
https://wordpress.org/plugins/wp-mail-smtp/


Your app should return:
FALSE if failure
1 if success [the default number of emails was fetched]
2 if nothing to fetch [in other words, no new emails to process]

In your reply, please explain how you would build this in a few sentences. I'm a programmer. I don't care about your experience or how great you are.

Just explain what you will do.
Related categories: PHP Python Linux Bash WordPress Plugin