hack princeton
-
Upload
kunal-batra -
Category
Technology
-
view
176 -
download
3
description
Transcript of hack princeton
![Page 1: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/1.jpg)
Hack Princeton
Kunal BatraDeveloper Evangelist
11/08/13
![Page 2: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/2.jpg)
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](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/3.jpg)
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](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/4.jpg)
Some of our APIs
• SMTP API• Web API• Parse Webhook (Cool!)• Event Webhook
![Page 6: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/6.jpg)
Take a Photo
![Page 7: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/7.jpg)
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](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/8.jpg)
Convert Photo to text
$ocrapi = new Abby($config['abby']['app_id'], $config['abby']['password']);$docName = $ocrapi->convert($file['name']);
![Page 9: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/9.jpg)
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](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/10.jpg)
Awesome Prizes- Retro NES/SNES Game Systems
![Page 11: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/11.jpg)
Ouya Gaming Console
![Page 12: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/12.jpg)
Mortal Kombat- 1993
![Page 13: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/13.jpg)
Assorted NES Games
![Page 14: hack princeton](https://reader033.fdocuments.in/reader033/viewer/2022061218/54b707bc4a7959524f8b457f/html5/thumbnails/14.jpg)
Hack.Sendgrid.com
GO TOHack.Sendgrid.comSign up for a FREE account &&Tweet @kunal732 with your SendGrid username to get setup.