Send email with PDF attachment using PHP

Sometimes we may need to send email from our website to the client with some attachment. In this tutorial we will query the MySQL database to get the updated data from our table and email the data to the desired email as PDF attachment.

Live Demo Download

For this we will use

  1. AngularJS [For front end]
  2. PHP [To query the database and send email]
  3. MySQL [The database]
  4. fPDF library [This will generate the PDF for us]
  5. SendGrid [This helps us sending the email in a better way]

code

index.html

books.sql

app.js

config.php

database.php

index.php

sendgrid.php