Hi
i have an htm created by ob_start--ob_clean (query from mysql)
i can have more than 1 html each one for a user these htmls are converted to pdf using html2pdf and each file is called by the name of the cleint
ex:if the user name is xxxx===>he will get xxxx.pdf file
my problem how i can send each of these files to a specific user
xxxx.pdf must be attached to xxxx user ..
everything is working perfect only i cannot find a method to send these emails
pls check the last part of the code
----------------html2pdf------------
try {
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8',5);// you can use the default parms
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($output);
$html2pdf->Output($surname.'.pdf','F');
}
catch(HTML2PDF_exception $e) {
echo $e;
}
//-----------------------------------------------
//DECLARE LES VARIABLES
//-----------------------------------------------
$email_expediteur='info@campion.ie';
$email_reply='email_de_reponse@fai.fr';
$message_texte='Bonjour,'."\n\n".'Voici un message au format texte';
$message_html='<html>
<head>
<title>Titre</title>
</head>
<body>Test de message</body>
</html>';
//-----------------------------------------------
//GENERE LA FRONTIERE DU MAIL ENTRE TEXTE ET HTML
//-----------------------------------------------
$frontiere = '-----=' . md5(uniqid(mt_rand()));
//-----------------------------------------------
//HEADERS DU MAIL
//-----------------------------------------------
$headers = 'From: "Nom" <'.$email_expediteur.'>'."\n";
$headers .= 'Return-Path: <'.$email_reply.'>'."\n";
$headers .= 'MIME-Version: 1.0'."\n";
$headers .= 'Content-Type: multipart/mixed; boundary="'.$frontiere.'"';
//-----------------------------------------------
//MESSAGE TEXTE
//-----------------------------------------------
$message = 'This is a multi-part message in MIME format.'."\n\n";
$message .= '--'.$frontiere."\n";
$message .= 'Content-Type: text/plain; charset="iso-8859-1"'."\n";
$message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
$message .= $message_texte."\n\n";
//-----------------------------------------------
//MESSAGE HTML
//-----------------------------------------------
$message .= '--'.$frontiere."\n";
$message .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
$message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
$message .= $message_html."\n\n";
$message .= '--'.$frontiere."\n";
//-----------------------------------------------
//PIECE JOINTE
//-----------------------------------------------
$message .= 'Content-Type: application/pdf; name="monthly.pdf"'."\n";
$message .= 'Content-Transfer-Encoding: base64'."\n";
$message .= 'Content-Disposition:attachement; filename="monthly.pdf"'."\n\n";
$message .= chunk_split(base64_encode(file_get_contents($surname.'.pdf')))."\n";
if(mail($email,$sujet,$message,$headers))
{
echo 'Le mail a été envoyé';
}
else
{
echo 'Le mail n\'a pu être envoyé';
}