Skip to content

Instantly share code, notes, and snippets.

View sebmih's full-sized avatar

Sebastian Mihalache sebmih

  • DeepStream
  • Iași
View GitHub Profile
@sebmih
sebmih / rubyapi.rb
Created November 27, 2013 06:20
This script should send emails by with categories and unique args.
require '~/Dev/ruby/SmtpApiHeader.rb'
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "smtp.sendgrid.net",
:port => 587,
:domain => "sendgrid.com",
:user_name => "sebfree",
:password => "*******",
:authentication => 'plain',
@sebmih
sebmih / invitation
Created November 25, 2013 11:34
Google Event Invitation Headers
Content-Type: text/calendar; charset=UTF-8; method=REQUEST
Content-Transfer-Encoding: 7bit
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20131125T120000Z
@sebmih
sebmih / event_parse.php
Created November 21, 2013 07:58
A script that should decode JSON events.
<?php
$handle = @fopen('./tmp/dump.log', "r");
if ($handle)
{
// read till the end of the file
while (!feof($handle))
{
// read a line from the file
$line = fgets($handle, 4096);
// decode the json -> assoc. array
@sebmih
sebmih / nlapiadd.rb
Created November 8, 2013 08:08
This script will try adding multiple email addresses to a recipient list using the NL API.
require 'httparty'
require 'JSON'
url = 'https://sendgrid.com/api/newsletter/lists/email/add.json'
#the arrays containg email addreses and custom tags
emails = ['andrei@sendgridson2.com','andrejstg@gmai2l.com']
names = ['Andrei1','Andrei2']
array = []
@sebmih
sebmih / curlcsv.php
Created October 17, 2013 06:57
A working script that creates a CSV file using the data from a cURL request.
<?php
$url = 'http://sendgrid.com/';
$user = 'schoologysendgridapi';
$pass = '*********';
$params = array(
'api_user' => $user,
'api_key' => $pass,
'email' => 'ahandler@stewie.schoologize.com',
'date' => '1',
@sebmih
sebmih / NLAPI2.php
Created October 17, 2013 04:06
A working PHP script that adds multiple addresses for the ME API.
<?php
$username='SG_username';
$password='SG_password';
$url = 'https://sendgrid.com/api/newsletter/lists/email/add.json?api_user='.$username.'&api_key='.$password;
// API call including username and password
$email=array('email@domain.com','mail@example.com','mailz@email.com');
//initialize the email array
$name=array('Name1','Name2','Name3');
@sebmih
sebmih / headers.txt
Created August 30, 2013 12:54
Two DKIM signatures
Delivered-To: sendgrid.tests@gmail.com
Received: by 10.216.248.138 with SMTP id v10csp35227wer;
Fri, 30 Aug 2013 05:51:53 -0700 (PDT)
X-Received: by 10.60.50.135 with SMTP id c7mr6778616oeo.41.1377867113157;
Fri, 30 Aug 2013 05:51:53 -0700 (PDT)
Return-Path: <bounces+700795-f0ca-sendgrid.tests=gmail.com@oe.e-anjal.in>
Received: from o1.oe.e-anjal.in (o1.oe.e-anjal.in. [192.254.116.81])
by mx.google.com with SMTP id t6si4994524oei.83.1969.12.31.16.00.00;
Fri, 30 Aug 2013 05:51:53 -0700 (PDT)
@sebmih
sebmih / smtpapilib.php
Created August 30, 2013 05:28
A script based on the GitHub library that enables the Subscription Tracking app.
<?php
include 'sendgrid-php-master/SendGrid_loader.php';
$sendgrid = new SendGrid('*******', '*******');
$mail = new SendGrid\Mail();
$mail->
addTo('sebi.mihalache@gmail.com')->
setFrom('sebastian.mihalache@sendgrid.com')->
setSubject('Kvitto din kförs betalning nördlichen blabla Hemisphäre ciment')->
setText('Testing %name% subject.')->
@sebmih
sebmih / headers.txt
Created August 27, 2013 08:40
A sample header for the 'software2' Bronze account.
Received: by 10.216.248.138 with SMTP id v10csp285697wer;
Tue, 27 Aug 2013 01:38:56 -0700 (PDT)
X-Received: by 10.182.88.202 with SMTP id bi10mr953674obb.91.1377592736225;
Tue, 27 Aug 2013 01:38:56 -0700 (PDT)
Return-Path: <bounces+236416-e7b6-sendgrid.tests=gmail.com@sendgrid.info>
Received: from o5.b99.sendgrid.net (o5.b99.sendgrid.net. [74.63.236.162])
by mx.google.com with SMTP id t6si5898479oei.18.1969.12.31.16.00.00;
Tue, 27 Aug 2013 01:38:56 -0700 (PDT)
Received-SPF: pass (google.com: domain of bounces+236416-e7b6-sendgrid.tests=gmail.com@sendgrid.info designates 74.63.236.162 as permitted sender) client-ip=74.63.236.162;
Authentication-Results: mx.google.com;
@sebmih
sebmih / uuencode.txt
Created August 1, 2013 06:31
The source of an email containing an Uuencoded attachment.
From: indexhelp@db.com
Message-Id: <201307292145.r6TLjuwO016779@nyiqcalp1.us.db.com>
X-Authentication-Warning: nyiqcalp1.us.db.com: dbiqcalp set sender to
indexhelp@db.com using -f
To: DBXIndexLevels@list.db.com, rohit.padebettu@db.com,
dbx-import-ce2dd12b@sendgrid.dbxus.com
Subject: DBCS Index level Report, Date : 20130726
X-BeenThere: dbxindexlevels@list.db.com
Precedence: list
List-Id: dbxindexlevels.list.db.com