hack princeton

14
Hack Princeton Kunal Batra Developer Evangelist 11/08/13

Upload: kunal-batra

Post on 15-Jan-2015

175 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: hack princeton

Hack Princeton

Kunal BatraDeveloper Evangelist

11/08/13

Page 2: hack princeton

What is SendGrid ?

• Cloud based SMTP email Provider– Transactional: Registration, forgotten

passwords, account notifications.

• Massively Scalable• Analytics on the emails you send

– Unsubscribes, bounces …etc.

Page 3: hack princeton

Why not build it myself ?

• Focus on your core application

• Maintaining Email Infrastructure Sucks!– Costly, Time-consuming, Boring!!

• 20% of legitimate email goes to spam

Page 4: hack princeton

Some of our APIs

• SMTP API• Web API• Parse Webhook (Cool!)• Event Webhook

Page 5: hack princeton

Parse API Demo!!

Take a photo of some Text&&

Send an email to:

[email protected]

Page 6: hack princeton

Take a Photo

Page 7: hack princeton

Parse Data from email

//Get Post from SendGrid

$from = $_POST["from"];$subject = $_POST["subject"];

//Get Attached Image $fh = fopen('/tmp/parse.log', 'a+');if ( $fh ) { fwrite($fh, print_r($_POST, true) . print_r($_FILES, true)); foreach ($_FILES as $key => $file) { move_uploaded_file($file['tmp_name'], "upload/".$file['name']); } fclose($fh); }

Page 8: hack princeton

Convert Photo to text

$ocrapi = new Abby($config['abby']['app_id'], $config['abby']['password']);$docName = $ocrapi->convert($file['name']);

Page 9: hack princeton

Send reply email//Send reply email with attached text document $filePath = dirname(__FILE__).'/upload/'.$docName;$sendgrid = new SendGrid($config['sendgrid']['api_user'], $config['sendgrid']['api_key']);

$mail = new SendGrid\Mail();

$mail-> addTo($from)-> setFrom($config['sendgrid']['my_email'])-> setSubject('Re: '.$subject)-> setText($docName)-> setHtml($docName)-> addAttachment($filePath);

$sendgrid->smtp->send($mail)

Page 10: hack princeton

Awesome Prizes- Retro NES/SNES Game Systems

Page 11: hack princeton

Ouya Gaming Console

Page 12: hack princeton

Mortal Kombat- 1993

Page 13: hack princeton

Assorted NES Games

Page 14: hack princeton

Hack.Sendgrid.com

GO TOHack.Sendgrid.comSign up for a FREE account &&Tweet @kunal732 with your SendGrid username to get setup.