dolcezza Posted January 17, 2008 Share Posted January 17, 2008 I am a newbie at php and trying to generate a pdf, then email it. If I have the output() line it works fine....prompts me to download the pdf and everything is in there. When I add the mail part I get a blank page in the browser and no email. Any suggestions appreciated. Only posting relevant part of code require('fpdf.php'); $filename="bookingconfirmation.pdf"; //rest of pdf code here $pdf->Output($filename); include "libMail/class.phpmailer.php"; $m= new Mail; // create the mail $m->IsSMTP(); // telling the class to use SMTP $m->Host = "mail.connectingauthors.com"; // SMTP server $m->From("susan@connectingauthors.com"); $m->To("pixelart@optonline.net"); $m->Subject( "Connecting Authors Booking Confirmation" ); $m->Body( "HellonnPlease find attached ..." ); // set the body $m->Attach( $filename ) ; $m->Send(); // send the mail exit(); Quote Link to comment https://forums.phpfreaks.com/topic/86414-fpdf-and-phpmailer/ Share on other sites More sharing options...
KrisNz Posted January 17, 2008 Share Posted January 17, 2008 You're going to get a blank page since your script doesn't echo anything out. As for why your mail isn't sending its hard to say. try echoing out $m->ErrorInfo; after you send. Quote Link to comment https://forums.phpfreaks.com/topic/86414-fpdf-and-phpmailer/#findComment-441609 Share on other sites More sharing options...
dolcezza Posted January 17, 2008 Author Share Posted January 17, 2008 Is it possible to have 2 output lines? One with output() so they can download it directly, then one with a name output($whatever) for emailing? Quote Link to comment https://forums.phpfreaks.com/topic/86414-fpdf-and-phpmailer/#findComment-441671 Share on other sites More sharing options...
KrisNz Posted January 17, 2008 Share Posted January 17, 2008 If you want that to all happen on the same page, You'll need to send the email before you output the pdf. Your pdf library will almost certainly have a method for outputting directly to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/86414-fpdf-and-phpmailer/#findComment-441702 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.