How to hack a free web hosting service to setup a free mailer service

Yes you read it correctly there are two frees in one sentence of this post’s title. I am lucky to have a free web hosting service provided by freehostia. Its basic chocolate pack is completely free for life and has enough capacity to host my personal blog and website. But free things in life come with their own limitations as did this hosting service. This service doesn’t allow any connections to external hosts which means no contact forms on your website and no email forwarding to any of your personal email ids. The only solution was to use the mail service provided by hosting service provider which I was not willing to use as it would add another email to my already existing bunch of ids that I occasionally use. So after searching for the solution for a few days I had my light bulb moment. I thought how does it matter if it doesn’t allow any outgoing connections to external hosts it still allows incoming connections to the server. I can write the information of the contacting person from the contact form to some webpage and read that page using some script.
So this is the setup that I used. Firstly, I wrote the data coming from the contact form available on the website to a webpage along with its timestamp. Then I hosted a python script that ran every 10 minutes to scrape that webpage and mail me any contact information added to the page in the last 10 minutes. I used the heroku’s app hosting service to host the script and its scheduler add-on to run it every 10 minutes. And now I have a free mailer service for life. Following is the code for the script that runs every 10 minutes and scraps any contact information added in last 10 minutes and sends it as a mail. The data pipeline architecture is shown as follows:

Following is the code for the heroku scrapping and email script.

import smtplib
import requests, pytz
from datetime import datetime, timedelta
from bs4 import BeautifulSoup

class Gmail(object):
def __init__(self, email, password): = email
self.password = password
self.server = ''
self.port = 587
session = smtplib.SMTP(self.server, self.port)
session.login(, self.password)
self.session = session

def send_message(self, subject, body):
''' This must be removed '''
headers = [
"From: " +,
"Subject: " + subject,
"To: " +,
"MIME-Version: 1.0",
"Content-Type: text/html"]
headers = "\r\n".join(headers)
headers + "\r\n\r\n" + body)

class ReadPage(object):
def __init__(self):
message = ""
self.url = ''
page = requests.get(self.url, headers={'User-Agent': 'Chrome'})
soup = BeautifulSoup(page.text, 'html.parser')
data = soup.find_all('p')
now ="America/Chicago")).replace(second=0, microsecond=0)
print("now: ", now)
for i in range(5, len(data), 6):
time = " ".join(data[i].get_text().split(" ")[1:4])
time_format = '%m-%d-%Y %I:%M %p'
time = datetime.strptime(time, time_format)
time = (pytz.timezone("America/Chicago")).localize(time, is_dst=None)
print("time: ", time)
if now - time <= timedelta(seconds = 600):
message = message + str(data[i-5])
if message != "":
gm = Gmail('', '') # you will have to enable logging in through less secure apps in google settings
gm.send_message("Someone contacted you!!", message)

The form is live and working at