Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Sending attached file through a contact email form
A rather popular task that seems to not be exactly working with TXP. Not that I managed to find a solution for it.
This is what I need: a form on a page that would allow a user of the site to enter information and also be able to upload files that would be sent as an attachment along with the form email.
zem_contact_reborn didn’t do that last time I checked. I have sed_afu but it throws a bunch of tag errors when in debug mode and mem_moderation does the same upon approval of files (namely, reports missing arguments), AND I don’t need files to be stored on the server but emailed. mem_form is in the same league.
Is there any plugin solution for TXP at all, or you use an external script, and if so – which one and how?
I guess this will be useful to many.
Offline
Re: Sending attached file through a contact email form
oh. i search this solution too. pls help somebody!
<txp:txp_me />
Offline
Re: Sending attached file through a contact email form
Didn’t have time to play much with this, but I set up PHPMailer-FE to work by placing a mail form in a TXP form and calling the script. You will need to read on PHPMailer and the configuration options to set it properly.
Unfortunately, this is no plug-in solution but perhaps ZCR will get an extension at some point to be able to handle multi-part emails. Till that moment comes, I am finding my way around it.
Offline
Re: Sending attached file through a contact email form
thanks! i try and let you know!
<txp:txp_me />
Offline
#5 2010-04-22 07:34:04
- makss
- Plugin Author
- From: Ukraine
- Registered: 2008-10-21
- Posts: 355
Re: Sending attached file through a contact email form
Simple function for attachment:
function XMail( $from, $to, $subj, $text, $filename) { $f = fopen($filename,"rb"); $un = strtoupper(uniqid(time())); $head = "From: $from\n"; $head .= "To: $to\n"; $head .= "Subject: $subj\n"; $head .= "X-Mailer: PHPMail Tool\n"; $head .= "Reply-To: $from\n"; $head .= "Mime-Version: 1.0\n"; $head .= "Content-Type:multipart/mixed;"; $head .= "boundary=\"----------".$un."\"\n\n"; $zag = "------------".$un."\nContent-Type:text/html;\n"; $zag .= "Content-Transfer-Encoding: 8bit\n\n$text\n\n"; $zag .= "------------".$un."\n"; $zag .= "Content-Type: application/octet-stream;"; $zag .= "name=\"".basename($filename)."\"\n"; $zag .= "Content-Transfer-Encoding:base64\n"; $zag .= "Content-Disposition:attachment;"; $zag .= "filename=\"".basename($filename)."\"\n\n"; $zag .= chunk_split(base64_encode(fread($f,filesize($filename))))."\n"; if (!@mail("$to", "$subj", $zag, $head)) return 0; else return 1; }
Getting from opennet.ru
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: Sending attached file through a contact email form
datorhaexa wrote:
Didn’t have time to play much with this, but I set up PHPMailer-FE to work by placing a mail form in a TXP form and calling the script. You will need to read on PHPMailer and the configuration options to set it properly.
Hi!
Everytime when i want to submit form after fully configuration of phpmailer-fe, i get this error:
The form was not submitted for the following reasons:
* your email address is invalidPlease use your browser’s back button to return to the form and try again.
How to fix?
Last edited by Katalonian (2010-04-26 22:38:43)
<txp:txp_me />
Offline
Re: Sending attached file through a contact email form
I’m not sure what the problem might be there, besides something in your configuration that doesn’t behave well. You can read more on the PHPMailer-FE pages or check your server configuration, in case you are working on a local test server.
Besides that, do search online – there are many mailing scripts one can modify, integrate and build on, if the one above is too much of a hassle to deal with.
Offline