A Flask web application for checking your email via text message
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A simple Python Flask application for checking your gmail via text message.

I sometimes find myself in the situation where I have a cellular signal without a data signal on my phone. This application allows me to check my email via text message in these situations, bypassing the data network.

The entire application round trip is as follows:

Phone SMS <-> Twilio <-> App Engine Server <-> Gmail Server

Run Locally

Note: Running this application locally isn't very helpful, as there is a bug in the App Engine SDK that does not allow local use of sockets. You also need to use ngrok, or a similar service to expose your local application to the internet for Twilio access. A better option is to deploy to App Engine and test your deployment.

  1. Install the App Engine Python SDK. You'll need python 2.7 and pip 1.4 or later installed too.

  2. Clone this repo with

    $ git clone https://github.com/psthomas/textmail.git
  3. Install dependencies in the project's lib directory. Note: App Engine can only import libraries from inside your project directory.

    $ cd local/clone
    $ pip install -r requirements.txt -t lib --ignore-installed

    Note: The above --ignore-installed tag is optional if you're working in a virtual environment.

  4. Create a config.py file similar to the example below, filled in with your email address, password, phone number, secret key and a secret url string.

  5. Run this project locally from the command line:

    $ dev_appserver.py .


To deploy the application, install the dependencies and create a config.py as outlined above, then:

  1. Use the Admin Console to create a project/app id. (App id and project id are identical) Add this app id to your app.yaml file.

  2. Enable billing on your developer account, and start the free trial, which enables the free use of sockets for your application.

  3. Deploy the application with

    appcfg.py -A <your-project-id> update .
  4. Your application is now live at your-app-id.appspot.com

  5. Allow less secure apps[1] to access your Gmail account, and enable IMAP access on your account.

  6. Create a Twilio account, and link the account with with your secret url (your-app-id.appspot.com/secret_string). Try out your application by sending your Twilio number a blank text from a phone number you have included in CALLERS in config.py. You should get a formatted text response containing the subjects and senders of the first five emails of your inbox.

[1] Note: Allowing less secure apps access to your Gmail account isn't a great idea. I have only used this application on a throwaway Gmail account. I'm currently developing a version that uses Google's Oauth2.0 authentication and RESTful API, which is more secure.

Configuration File Example

Create config.py file, similar to this in top level directory:

## config.py

DEBUG = False
SECRET_KEY = 'very-secret'
CALLERS = {"+15555555555" : "Me"}
EMAIL = 'your-gmail-account@gmail.com'
PASSWORD= 'your-password'
SECRET_URL = 'long-random-string'