1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
$chemin = getcwd();
$chemin = "$chemin\\$name";
$this->pdf->Output($chemin,'F');
if (file_exists($name))
{
$file_type = filetype($chemin);
$file_size = filesize($chemin);
$handle = fopen($chemin, 'r') or die('File '.$name.'can t be open');
$content = fread($handle, $file_size);
$fichier = chunk_split(base64_encode($content));
fclose($handle);
$msg .= '--'.$this->boundary.$eol;
$msg .= "Content-type: $file_type; name=".$name.$eol;
$msg .= 'Content-transfer-encoding:base64'.$eol;
$msg .= 'Content-Disposition. attachment'.$eol;
$msg .= $fichier.$eol;
}
$msg .= '--'.$this->boundary.'--'.$eol;
mail($this->to, $this->sujet, $msg, $headers);
unlink($chemin); |