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
- Create an SendGrid account at http://sendgrid.com/pricing.html
- Create two custom environment variables setting your username and password for your account.
rhc set-env sendgrid_user=<username> sendgrid_password=<password> -a <appname>
- Configure php/send_email.php file with your email address, subject, text content and html content.
$mail-> addTo('firstname.lastname@example.org')-> setFrom('email@example.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!
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