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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
nasirbestConnect With a Mentor Commented:
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
 
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
 
CenturyRowAuthor Commented:
Thank you.
0
All Courses

From novice to tech pro — start learning today.