PDA

View Full Version : Sending PDF from Website to E-Mail



GeneralONeil
09-19-2008, 05:37 PM
Hi, I have a website here for my work where we have new patients fill out the registration forms (which is a pdf) and then the click a submit button at the bottom.

The problem I am having is that when they click submit, it forces them to use their own e-mail to send the completed pdf to the e-mail. The reason why this occurs is because I am using the "Mailto:" in my code.

I would like for the completed pdf to just be sent directly to an e-mail and not need the users to use their e-mail to send it.

redsox9
09-19-2008, 06:20 PM
Are they sending it from an account at the office? Would it be possible then to just have them enter a default account that you create, eg., patientform@yourdomain.com?

GeneralONeil
10-07-2008, 04:29 PM
What i'm looking for is that they click the submit button, and the completed pdf form is just sent instantly to an e-mail of my choice at work.

The patients don't fill them out at the office, but at home. I want them to click the button and be done, not have to deal with all the "Mailto:" stuff that happens after.



Thank You for helping, I appreciate it.

charlesp
10-08-2008, 02:11 AM
It should be easy enough to do with php or asp.

GeneralONeil
10-09-2008, 12:46 PM
You wouldn't happen to know the code for it would you? I don't know any php, sadly. All I need is that when they click the submit button on the PDF file is that the completed file is sent as an attachment to my e-mail.

I really appreciate the help by the way. Thank you for your time.

DonM
10-16-2008, 12:11 PM
I generate a pdf file prior to this snippet of code using FPDF and then email it to a large group of recipients. The pdf is basically performance data gathered from files.

Hope this helps.

Don



<?php
include('Mail.php');
include('Mail/mime.php');
$filename = 'yourpdf.pdf';
$recipients = 'youremail@yourdomain.com';
$text = 'Please see attached PDF file.';
$html = '<html><body>The attached PDF contains
information.
</body></html>';
$crlf = "\n";
$hdrs = array(
'From' => 'someone@yourdomain.com',
'Subject' => "PDF File",
'Reply-To' => 'someoneelse@yourdomain.com'
);

$mime = new Mail_mime($crlf);

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($filename, 'application/pdf');
//do not ever try to call these lines in reverse order
$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$mail->send($recipients, $hdrs, $body);
exit;
?>

GeneralONeil
10-17-2008, 10:53 AM
Thank you for the code, I'm pretty sure I understand what is happening, i'll give it a shot, and post back if I have any questions.

Malik_Hemani
10-23-2008, 08:38 PM
Hello All,

I see you are discussing exactly what we want.

Our goal is to post the pdf form online on our website. when customers open the pdf via the website they need to fill the data and hit submit.

Right now when they hit submit it ask if they are using desptop email or webmail. If desktop, outlook opens and sends. If webmail they have to safe the file, go to webmail attach and send.

We want when they hit submit behind the scene it emails either the data or the pdf to the email address we provide. After sending redirects to a confirmation page.

I see the above script but dont get where and what am i suppose to do with it. Please help!

Please let us know if you have a solution.

Thanks

GeneralONeil
11-13-2008, 02:38 PM
Sorry for the long wait. I am having the same issue as Malik. I took the code from above, but i'm not a php coder so I don't know how to impliment it. Also which fields within the code do I edit? Also if anyone could explain the lines of code, I would greatly appreciate it, though the explanations are not really that important.


*Edit: Ok I attempted to get the code to work another way, and when I click submit I get a page with the following text:

Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in /home/trivall6/public_html/tvimg/phpcode2.php on line 2

Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/trivall6/public_html/tvimg/phpcode2.php on line 2

Warning: include(Mail/mime.php) [function.include]: failed to open stream: No such file or directory in /home/trivall6/public_html/tvimg/phpcode2.php on line 3

Warning: include() [function.include]: Failed opening 'Mail/mime.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/trivall6/public_html/tvimg/phpcode2.php on line 3

Fatal error: Class 'Mail_mime' not found in /home/trivall6/public_html/tvimg/phpcode2.php on line 17

Any help with this issue is greatly appreciated, Thanks again for everything.

Malik_Hemani
11-16-2008, 05:01 PM
any luck? i am still lost as to how to implement this.

thanks

GeneralONeil
11-17-2008, 11:58 AM
No, still working on it. I wish I knew more php. I get that above error, not sure what to do. If I figure anything out, i'll update it here in the thread for you to use. If you find anything out, feel free to post here, i'll gladly try and help you out.

Moonshiner
11-19-2008, 08:12 AM
Does it have to be in PDF format? I'm using a contact form now on all my web sites just to eliminate posting our email addresses out there. I'm using a free www.tectite.com if that helps at all. When they SUBMIT, it can go to whoever and how many you want. It's PHP FormMail.

Malik_Hemani
11-19-2008, 10:33 AM
Hello moonshiner,

thanks for the reply but we need pdf because the form is about 3 - 4 pages long. Another reason is when submitted the raw data can be imported back into the orig PDF and printed so when printed it looks like the real form that someone would have filled out and we can file. if you do a PHP Form mail you get plain email.

i hope that makes sense.

GeneralONeil
11-19-2008, 11:03 AM
Indeed it does have to be PDF, for the same reason mentioned above. In my case I work for a doctor's office and the PDF is the new patient registration, and a plain e-mail with just the entered data would be too confusion for the Front office receptionists. Also the fact that there are close if not over a hundred things to fill in (Ex. Name, address, as well as yes no bubbles and other radio options).

Thank you for the website though, maybe it will come in handy. I really appreciate your help and the time you took to respond.

GeneralONeil
12-04-2008, 05:24 PM
Anyone get it to work? It's real close except for the problem I am having...

GeneralONeil
01-07-2009, 11:34 AM
Ok, I'm still working on this, has anyone figured it out? I've been getting closer, the problem with the code is that I do not have the mail, mime, or Mail_mime classes.

Anyone have code for these?

Thank you all for your help.

felgall
01-07-2009, 01:06 PM
You need to be using a form2mail script that can handle PDF attachments and do the attachment however that script expects you to do it.

Are you sure the form2mail script you are using accepts attachments and if so are you sure PDF is one of the supported types of attachment that it supports?

GeneralONeil
01-07-2009, 05:37 PM
Ok I got the code to work, only problem is it doesn't send the text that is entered only the original blank pdf. I'm assuming the file needs to be saved and then sent. Any way to save to a temp pdf?

felgall
01-07-2009, 07:00 PM
All attachments need to be base64 encoded into the email itself to be sent as an attachment.The form2mail script needs to do that when copying the PDF into the email.

silencox
02-02-2009, 01:32 AM
Hello

few month ago i have similar project

Customer have form where user enter details such as personal details, car details, rental details after he submitted form, customer get filled pdf document and this document data are stored in database, and admin get notification that someone is filled form and get link to form details ( so he don't need to download pdf ).

with using FPDF it's pretty easy to achieve this since you need only to follow input fields in form, the other part is that you need to create PDF form file.

If you need help with this let me know

silencox
02-10-2009, 06:49 AM
Are you sending an email with a pdf already opening or is it something that they can download?http://www.image-jump.com/image/Q/8.gif

Let me know, i have a software. thanks...

Here is details:

client have form when user fill form and press send he get FPDF data file ( also admin get same file ( optional ) and FPDF data file is stored on server sorted by date and it have automatic deletion after 30 days, when user want to check data FPDF ( or print ) file is linked with PDF file stored on server

FPDF file is cca. 30Kb
PDF is cca 100Kb

that is it