PHP script to email FDF data

Can someone point me to a PHP script to email to a single email address FDF data generated by an on-line pdf form?  The PHP script needs to operate on a Debian Linux server, which has sendmail loaded.
CenturyRowAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nasirbestCommented:
use following code just remember to adjust pdf , and html, text templates path
$company_name = "My Company";
$company_email = "mail@company.my";
$user_email = "user@company.com";
$subject = "Customer Email";

$random_hash = md5(uniqid(time()));
$attachment = chunk_split(base64_encode(file_get_contents("/tmp/my.pdf")));

$body_email_text="path/to/body_email.txt.php";
ob_start();
include($body_email_text);
$txt_message = ob_get_clean();

$body_email_template="path/to/body_email.tpl.php";
ob_start();
include($body_email_template);
$html_message = ob_get_clean();

$header  = "From: $company_name <$company_email>\r\n";
$header .= "Reply-To: $company_email\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"mixed$random_hash\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--mixed$random_hash\r\n";

$header .= "Content-Type: multipart/alternative; boundary=\"alt$random_hash\"\r\n\r\n";
$header .= "--alt$random_hash\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $txt_message."\r\n\r\n";
$header .= "--alt$random_hash\r\n";
$header .= "Content-type:text/html; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $html_message."\r\n\r\n";
$header .= "--alt$random_hash--\r\n\r\n";

$header .= "--mixed$random_hash\r\n";
$header .= "Content-Type: application/pdf; name=\"invoice.pdf\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"invoice.pdf\"\r\n\r\n";
$header .= $attachment."\r\n\r\n";
$header .= "--mixed$random_hash--";

mail($user_email, $subject, '', $header);

Open in new window

0
nasirbestCommented:
a simple text template can be
Dear Username, 

Welcome

-------------------------
The <?php echo $company_name; ?> Team

and following is a html email tempalte

<p>
Dear User, 
</p>
<p>
Welcome. 
</p>

<p>
-------------------------<br />
The <?php echo $company_name; ?> Team<br />
</p>

Open in new window

0
CenturyRowAuthor Commented:
I am sorry.  Perhaps, I wasn't clear.  I have on-line an Adobe Acrobat pdf form.  When the form is completed and it  submit button pressed, the form generates fdf data.  I need a PHP script to capture that data and email it to a single email address.  I can then enter the URL were the php file is located on my server in the pdf form.
0
nasirbestCommented:
As currently I am not aware that what variables your pdf is using? and how it send these variables back to given url POST or GET; I am using a general method

put following code in some php file and remember to change the email address.
<?php 
$message = "POST DATA = " . print_r($_POST, true);
$message .= "\n\nGET DATA = " . print_r($_GET, true);

mail('you@example.com', 'My Subject', $message);
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CenturyRowAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Server Software

From novice to tech pro — start learning today.