SendGrid on OpenShift

Deploy Now

0 votes

This git repository helps you to send emails quickly and easily through SendGrid on OpenShift using PHP.

Once you've created the quickstart, you'll need to create a SendGrid account and add your authorization information to your Git repository. Making code changes will require you to set a public SSH key, and then to clone your new application Git repository onto your local machine. See the Getting Started page for more steps in this flow.

Step 1. Configure SendGrid with Your App

  1. Create an SendGrid account at http://sendgrid.com/pricing.html
  2. Create two custom environment variables setting your username and password for your account.
       rhc set-env sendgrid_user=<username> sendgrid_password=<password> -a <appname>
 
  1. Configure php/send_email.php file with your email address, subject, text content and html content.
          $mail->
               addTo('foo@bar.com')->
               setFrom('me@bar.com')->
               setSubject('Subject goes here')->
               setText('Hello World!')->
               setHtml('Hello World!');
 

Step 2. Deploy your app

    git add .
    git commit -m "my first commit"
    git push

Step 3. View your app!

    http://$appname-$yournamespace.rhcloud.com

More Information

For more details about SendGrid libray please read http://sendgrid.com/docs/Code_Examples/php.html

You can create your Sendgrid Quickstart with other programming languages using the following examples: http://sendgrid.com/docs/Code_Examples/index.html

Uses php-5.3 with code from https://github.com/sendgrid/openshift-sendgrid-php

Language: 
PHP