SlideShare a Scribd company logo
1 of 14
Hack Princeton
Kunal Batra
Developer Evangelist
11/08/13
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.
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
Some of our APIs
•
•
•
•

SMTP API
Web API
Parse Webhook (Cool!)
Event Webhook
Parse API Demo!!
Take a photo of some Text
&&

Send an email to:

ocrthat@si.ht
Take a Photo
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);
}
Convert Photo to text
$ocrapi = new Abby($config['abby']['app_id'], $config['abby']['password']);
$docName = $ocrapi->convert($file['name']);
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 SendGridMail();

$mail->
addTo($from)->
setFrom($config['sendgrid']['my_email'])->
setSubject('Re: '.$subject)->
setText($docName)->
setHtml($docName)->
addAttachment($filePath);
$sendgrid->smtp->send($mail)
Awesome Prizes- Retro
NES/SNES Game Systems
Ouya Gaming Console
Mortal Kombat- 1993
Assorted NES Games
Hack.Sendgrid.com

GO TO
Hack.Sendgrid.com
Sign up for a FREE account
&&
Tweet @kunal732 with your
SendGrid username to get
setup.

More Related Content

Similar to hack princeton

Fast and Easy Website Tuneups
Fast and Easy Website TuneupsFast and Easy Website Tuneups
Fast and Easy Website Tuneups
Jeff Wisniewski
 
SPSRED - BCS, REST ans Subscriptions
SPSRED - BCS, REST ans SubscriptionsSPSRED - BCS, REST ans Subscriptions
SPSRED - BCS, REST ans Subscriptions
Chris Givens
 

Similar to hack princeton (20)

LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email InfrastructureLAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
LAPHP/LAMPSig Talk: Intro to SendGrid - Building a Scalable Email Infrastructure
 
Phishing Intelligence Engine - BlueHat v17
Phishing Intelligence Engine - BlueHat v17Phishing Intelligence Engine - BlueHat v17
Phishing Intelligence Engine - BlueHat v17
 
Client side and server side scripting
Client side and server side scriptingClient side and server side scripting
Client side and server side scripting
 
EAC-VB2023.pdf
EAC-VB2023.pdfEAC-VB2023.pdf
EAC-VB2023.pdf
 
Datasploit - An Open Source Intelligence Tool
Datasploit - An Open Source Intelligence ToolDatasploit - An Open Source Intelligence Tool
Datasploit - An Open Source Intelligence Tool
 
Email_Account_Compromise_VB_2023_Final 2.pdf
Email_Account_Compromise_VB_2023_Final 2.pdfEmail_Account_Compromise_VB_2023_Final 2.pdf
Email_Account_Compromise_VB_2023_Final 2.pdf
 
Don't Get Phished!
Don't Get Phished!Don't Get Phished!
Don't Get Phished!
 
Fast and Easy Website Tuneups
Fast and Easy Website TuneupsFast and Easy Website Tuneups
Fast and Easy Website Tuneups
 
Get and post,session and cookie
Get and post,session and cookieGet and post,session and cookie
Get and post,session and cookie
 
SendGrid New Features 2016
SendGrid New Features 2016SendGrid New Features 2016
SendGrid New Features 2016
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
 
Power to the People: Manipulating SharePoint with Client-Side JavaScript
Power to the People:  Manipulating SharePoint with Client-Side JavaScriptPower to the People:  Manipulating SharePoint with Client-Side JavaScript
Power to the People: Manipulating SharePoint with Client-Side JavaScript
 
SPSRED - BCS, REST ans Subscriptions
SPSRED - BCS, REST ans SubscriptionsSPSRED - BCS, REST ans Subscriptions
SPSRED - BCS, REST ans Subscriptions
 
NZYP Project Casestudy using SilverStripe CMS
NZYP Project Casestudy using SilverStripe CMSNZYP Project Casestudy using SilverStripe CMS
NZYP Project Casestudy using SilverStripe CMS
 
null Bangalore meet - Php Security
null Bangalore meet - Php Securitynull Bangalore meet - Php Security
null Bangalore meet - Php Security
 
Owasp Top 10 A1: Injection
Owasp Top 10 A1: InjectionOwasp Top 10 A1: Injection
Owasp Top 10 A1: Injection
 
PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)
 
Amazon Machine Learning Workshop (實作工作坊)
Amazon Machine Learning Workshop (實作工作坊)Amazon Machine Learning Workshop (實作工作坊)
Amazon Machine Learning Workshop (實作工作坊)
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011
 
DataSploit - BlackHat Asia 2017
DataSploit - BlackHat Asia 2017 DataSploit - BlackHat Asia 2017
DataSploit - BlackHat Asia 2017
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

hack princeton

  • 2. 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.
  • 3. 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
  • 4. Some of our APIs • • • • SMTP API Web API Parse Webhook (Cool!) Event Webhook
  • 5. Parse API Demo!! Take a photo of some Text && Send an email to: ocrthat@si.ht
  • 7. 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); }
  • 8. Convert Photo to text $ocrapi = new Abby($config['abby']['app_id'], $config['abby']['password']); $docName = $ocrapi->convert($file['name']);
  • 9. 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 SendGridMail(); $mail-> addTo($from)-> setFrom($config['sendgrid']['my_email'])-> setSubject('Re: '.$subject)-> setText($docName)-> setHtml($docName)-> addAttachment($filePath); $sendgrid->smtp->send($mail)
  • 14. Hack.Sendgrid.com GO TO Hack.Sendgrid.com Sign up for a FREE account && Tweet @kunal732 with your SendGrid username to get setup.