Skip to content

Instantly share code, notes, and snippets.

View sendgrid-gists's full-sized avatar

SendGrid DX sendgrid-gists

View GitHub Profile
@sendgrid-gists
sendgrid-gists / hello-email.sh
Last active May 11, 2016 17:43
"Hello World" for email, using SendGrid with cURL.
curl -X POST https://api.sendgrid.com/api/mail.send.json \
-H "Authorization: Bearer SENDGRID_APIKEY" \
-d "to=test@sendgrid.com" \
-d "from=you@youraddress.com" \
-d "subject=Sending with SendGrid is Fun" \
-d "html=and easy to do anywhere, even with cURL"
@sendgrid-gists
sendgrid-gists / hello-email.js
Last active May 11, 2016 17:44
"Hello World" for email, using SendGrid with Node.js.
// using SendGrid's Node.js Library
// https://github.com/sendgrid/sendgrid-nodejs
var sendgrid = require("sendgrid")("SENDGRID_APIKEY");
var email = new sendgrid.Email();
email.addTo("test@sendgrid.com");
email.setFrom("you@youremail.com");
email.setSubject("Sending with SendGrid is Fun");
email.setHtml("and easy to do anywhere, even with Node.js");
@sendgrid-gists
sendgrid-gists / hello-email.rb
Last active May 11, 2016 17:45
"Hello World" for email, using SendGrid with Ruby.
# using SendGrid's Ruby Library
# https://github.com/sendgrid/sendgrid-ruby
require 'sendgrid-ruby'
sendgrid = SendGrid::Client.new do |c|
c.api_key = 'SENDGRID_APIKEY'
end
email = SendGrid::Mail.new do |m|
m.to = 'test@sendgrid.com'
@sendgrid-gists
sendgrid-gists / hello-email.py
Last active May 11, 2016 17:46
"Hello World" for email, using SendGrid with Python.
# using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import sendgrid
client = sendgrid.SendGridClient("SENDGRID_APIKEY")
message = sendgrid.Mail()
message.add_to("test@sendgrid.com")
message.set_from("you@youremail.com")
message.set_subject("Sending with SendGrid is Fun")
@sendgrid-gists
sendgrid-gists / hello-email.go
Last active May 11, 2016 17:46
"Hello World" for email, using SendGrid with Go.
// using SendGrid's Go Library
// https://github.com/sendgrid/sendgrid-go
package main
import (
"github.com/sendgrid/sendgrid-go"
)
func main() {
sg := sendgrid.NewSendGridClientWithApiKey("SENDGRID_APIKEY")
@sendgrid-gists
sendgrid-gists / hello-email.java
Last active May 11, 2016 17:47
"Hello World" for email, using SendGrid with Java.
// using SendGrid's Java Library
// https://github.com/sendgrid/sendgrid-java
import com.sendgrid.*;
public class SendGridExample {
public static void main(String[] args) {
SendGrid sendgrid = new SendGrid(SENDGRID_APIKEY);
SendGrid.Email email = new SendGrid.Email();
@sendgrid-gists
sendgrid-gists / hello-email.cs
Last active May 11, 2016 17:47
"Hello World" for email, using SendGrid with C#.
// using SendGrid's C# Library
// https://github.com/sendgrid/sendgrid-csharp
using System.Net.Http;
using System.Net.Mail;
var myMessage = new SendGrid.SendGridMessage();
myMessage.AddTo("test@sendgrid.com");
myMessage.From = new MailAddress("you@youremail.com", "First Last");
myMessage.Subject = "Sending with SendGrid is Fun";
myMessage.Text = "and easy to do anywhere, even with C#";
{
"category": [
"newuser"
],
"filters": {
"footer": {
"settings":
{
"enable": 1,
"text/plain": "Thank you for your business"
[
{
"sg_message_id":"sendgrid_internal_message_id",
"email": "john.doe@sendgrid.com",
"timestamp": 1337197600,
"smtp-id": "<4FB4041F.6080505@sendgrid.com>",
"event": "processed"
},
{
"sg_message_id":"sendgrid_internal_message_id",
{
"filters": {
"templates": {
"settings": {
"enable": 1,
"template_id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f"
}
}
}
}