Send Email in Python on Nitrous.IO


Posted on

NitrousWhen we announced our partnership with Nitrous, we showed how to send email with Rails. The platform-as-a-service and web-based IDE also currently supports Python, Node.js, Go, and PHP. In this tutorial, I’ll show how to use a Python development box on Nitrous to send email using SendGrid.

Get Started with Nitrous.IO / Python

We’ll use this sample app to show how easy it is to send email. You’ll want to create a Nitrous account and follow these steps:

  1. From the Nitrous New Boxes Page, create a new box using Python/DjangoCreate Python box
  2. Launch the IDE and go to the workspace folder in the Nitrous.IO terminal console.Go to workspace
  3. Clone the SendGrid sample application:
    git clone https://github.com/sendgrid/sendgrid-python-django-sample-app.git

    Clone sample app

  4. Install the SendGrid Python library:
    pip install --user sendgrid==0.3.1

    Install SendGrid Python libraryThe Python package manager will already be installed because Nitrous.IO pre-configures the boxes with software needed for each environment.

  5. In the Nitrous.IO file browser, open SGapp/settings.py and change the username/password data to be your SendGrid credentials.Update SendGrid credentials
  6. In the console go to “sendgrid-python-django-sample-app” folder and run the following command: ‘python manage.py runserver 0.0.0.0:8080′ to start the python serverRun the server
  7. Go to ‘Preview’ menu and select ‘Port 8080′ and the sample application will be opened in your browser.Open app
    Sample app form
  8. Send your first email through SendGrid/Nitrous.IO by filling out the form. Now go check your email.Your first email from SendGrid

Your message will be there, waiting for you. This is obviously a simple example application. When you use SendGrid in your production Python apps, you’ll likely be sending social notifications, password resets and other transactional email. Use this project as a starting point or reference for sending email with SendGrid in Python on Nitrous.IO.

Getting started is simple. Sign up with a free SendGrid account and claim your free cloud dev environment in 60 seconds with a Nitrous.IO account.


Adam DuVander speaks fluent "developer" while serving as Developer Communications Director. He helps SendGrid connect to coders of all stripes. Previously Adam wrote for Wired, Webmonkey and edited ProgrammableWeb, the leading resource for APIs.

Adam DuVander on Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>