Con questo codice il browser mi va in loop e non fa niente.
Ho modificato il codice in questo modo:
Codice PHP:
//$pdf->Output();
// email stuff (change data below)
$mail = new PHPMailer(); $mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = miauser;
// username
$mail->Password =mia pass;
// password // a random hash will be necessary to send mixed content
$separator = md5(time()); // carriage return type (we use a PHP end of line constant)
$eol = PHP_EOL; // attachment name $filename = "test.pdf"; // encode data (puts attachment in proper format)
$pdfdoc = $pdf->Output("", "S"); $attachment = chunk_split(base64_encode($pdfdoc)); // main header
$headers = "From: ".$from.$eol; $headers .= "MIME-Version: 1.0".$eol; $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\""; // no more headers after this, we start the body! //
$body = "--".$separator.$eol;
$body .= "Content-Transfer-Encoding: 7bit".$eol.$eol; $body .= "This is a MIME encoded message.".$eol; // message
$body .= "--".$separator.$eol;
$body .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol; $body .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $body .= $message.$eol; // attachment
$body .= "--".$separator.$eol; $body .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; $body .= "Content-Transfer-Encoding: base64".$eol;
$body .= "Content-Disposition: attachment".$eol.$eol;
$body .= $attachment.$eol; $body .= "--".$separator."--"; // send message
mail($to, $subject, $body, $headers);