Using the SendGrid API to send emails from your mobile apps

Blog images

SendGrid is a cloud-based service that exposes and easy-to-use API to send emails from your apps, and Appcelerator apps are no exception. Sendgrid just published an Appcelerator library that makes it even easier to use.

To use it, first sign up for a free SendGrid account at The user name and password you choose will be the ones you’ll use for the library.

The library is currently hosted on GitHub and soon will be available in the Appcelerator Marketplace. Locate the file tisendgrid.js and copy it to your project folder.

After doing this, using the library is as easy as obtaining a reference and calling the send method.

var sendgrid = require('tisendgrid')(sendgrid_username, sendgrid_password);

var email = {
    to:         email_to_address,
    from:       email_from_address,
    subject:    email_subject,
    text:       email_message_text

var message = sendgrid.Email(email);

sendgrid.send(message, function(e) {
    if (e) {
        alert('Message sent');

This code is all you need to send a simple email. If you’d like to send to multiple recipients, simply assign an array of email addresses to the to field like so:

to: ['','']

The library also has some other advanced functionalities such as filters, explained in their own blog post.

That’s all there is to it. Stay tuned for a future blog post where I’ll show you how to use SendGrid from your Node.ACS apps.


  1. I am traying Sendgrid with my mobile app in Visual Studio 2013.
    I have an error with the tisendgrid.js code, that is :

    Ti.Network.createHTTPClient … (Ti is not defined)

    May be I need some more files?

Comments are closed.