PDF attach and send via Email

I have a report page.and after click email button auto generate PDF file.in that file i wont to automatically download and attach to the email .How can i do it in PHP

[php]
session_start();
include(“Connector.php”);
include(‘fpdf17/fpdf.php’);
extract($_POST);

//create a FPDF object
$pdf=new FPDF();

//set document properties
$pdf->SetAuthor(‘university of ruhuna.’);
$pdf->SetTitle(‘PURCHASE ORDER PDF’);

//set font for the entire document
$pdf->SetFont(‘Helvetica’,‘B’,20);
$pdf->SetTextColor(50,60,100);

//set up a page
$pdf->AddPage(‘P’);
$pdf->SetDisplayMode(‘real’,‘default’);

//insert university logo
$image=“images/eplan_logo.jpg”;
$pdf->SetXY(40,20);
$pdf->Image($image , $pdf->GetX(), $pdf->GetY(), 40);

$pdf->SetXY (15,105);
$pdf->SetFillColor(204,204,204);

$pdf->Cell(15,5,‘Buyer PO’,1,0,‘C’,true);
$pdf->Cell(30,5,‘Description’,1,0,‘C’,true);
$pdf->Cell(30,5,‘Order#/ Sty #’,1,0,‘C’,true);
$pdf->Cell(15,5,‘SC NO’,1,0,‘C’,true);
$pdf->Cell(15,5,‘Item Code’,1,0,‘C’,true);
$pdf->Cell(15,5,‘Del Date’,1,0,‘C’,true);
$pdf->Cell(7,5,‘Size’,1,0,‘C’,true);
$pdf->Cell(10,5,‘Color’,1,0,‘C’,true);
$pdf->Cell(7,5,‘Unit’,1,0,‘C’,true);
$pdf->Cell(19,5,‘Unit Price’,1,0,‘C’,true);
$pdf->Cell(7,5,‘QTY’,1,0,‘C’,true);
$pdf->Cell(10,5,‘Value’,1,0,‘C’,true);

//Output the document
$pdf->Output(‘Purchase_Order.pdf’,‘I’);

[/php]

But in this i have to manual download.there for i cant attach that one in email attachment.

Sponsor our Newsletter | Privacy Policy | Terms of Service