Skip to content

Instantly share code, notes, and snippets.

brandonmwest / testing.php
Created February 28, 2012 16:23
Testing WP integration
include_once "lib/swift_required.php";
* Create the body of the message (a plain-text and an HTML version).
* $text is your plain-text email
* $html is your html version of the email
* If the reciever is able to view html emails then only the html
* email will be displayed
brandonmwest / gist:3384117
Created August 18, 2012 03:17
Adding recipients to the X-SMTPAPI Header with sendgrid-csharp
using System;
using System.Collections.Generic;
using SendGridMail;
using System.Net;
using SendGridMail.Transport;
using System.Net.Mail;
namespace EmailTester
class MainClass
brandonmwest / gist:3536551
Created August 30, 2012 18:23
Hierarchical tree of pages in Jekyll
require 'digest/md5'
module Jekyll
# Add accessor for directory
class Page
attr_reader :dir
class NavTree < Liquid::Tag
def render(context)
brandonmwest / fake_names.rb
Created September 5, 2012 02:35
Generate a csv of fake names and email addresses
require 'faker'
require 'csv'"output.csv", "wb") do |csv|
until i == 25000
fake = [,]
csv << fake
brandonmwest / gist:4512396
Last active June 25, 2022 13:11
curl + PHP example of using the SendGrid web api

This example uses cURL with PHP through our web API to send an email.

<?php $url = '';
$user = 'USERNAME';
$pass = 'PASSWORD'; 
$params = array(
    'api_user'  => $user,
 'api_key' =&gt; $pass,
brandonmwest / gist:4559791
Last active December 11, 2015 06:29
Windows Azure + SendGrid example

#How to: Create an email

Use the static SendGrid.GetInstance method to create an email message that is of type SendGrid. Once the message is created, you can use SendGrid properties and methods to set values including the email sender, the email recipient, and the subject and body of the email.

The following example demonstrates how to create an email object and populate it:

// Create the email object first, then add the properties.
var myMessage = SendGrid.GetInstance();
brandonmwest / gist:5016294
Created February 22, 2013 20:22
Send email from SendGrid using Pony gem
require 'rubygems'
require 'pony'
#set the default options
Pony.options = {
:from => '',
:via => :smtp,
:via_options => {
:address => '',
:port => '587',
brandonmwest / prettyprint.rb
Created February 24, 2013 01:07
Jekyll filter for pretty-printing HTML
require 'rubygems'
require 'json'
require 'nokogiri'
require 'nokogiri-pretty'
require 'fileutils'
module Jekyll
module PrettyPrintFilter
def pretty_print(input)
#seeing some ASCII-8 come in
brandonmwest / gist:5663960
Created May 28, 2013 16:16
sendgrid-perl example
use warnings;
use strict;
use Mail::SendGrid;
use Mail::SendGrid::Transport::SMTP;
my $sg = Mail::SendGrid->new( from => '',
to => '',
subject => 'Testing',
text => "Some text\n",
<?xml version="1.0" encoding="UTF-8" ?>