tobeyt23 Posted November 21, 2006 Share Posted November 21, 2006 Trying to attach a dynamically generated pdf as an attachement however it wont attach to the email. The URL for the attachment pulls data from the database and creates the PDF. Here is my code any suggestions:[code]<?phprequire_once 'phpmailer/class.phpmailer.php';$mail = new phpmailer();$yourEmail = '[email protected]';$yourName = 'Name';$recipientEmail = '[email protected]';$recipientName = 'Name';$mail->From = $yourEmail;$mail->FromName = $yourName;$mail->Subject = 'Test Attachment';$body = 'This message has an attachment';$mail->Body = $body;if (!$mail->AddAttachment('../sample.php?Product=24&Data=1', 'sample.pdf, 'base64', 'application/pdf')) { echo 'Failed to attach file!<br />';}$mail->AddAddress($recipientEmail, $recipientName);if (!$mail->Send()) { echo 'Mail sending failed';} else { echo ' Mail sent successfully'; }?>[/code] Link to comment https://forums.phpfreaks.com/topic/27978-email-attachment-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.