Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-03-10 17:20:02

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 115
Website

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

#2 2010-04-20 23:11:22

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

Re: Sending attached file through a contact email form

oh. i search this solution too. pls help somebody!


<txp:txp_me />

Offline

#3 2010-04-21 09:36:50

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 115
Website

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

#4 2010-04-21 09:47:11

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

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

#6 2010-04-26 22:37:47

Katalonian
Member
From: Baku, Azerbaijan
Registered: 2010-04-18
Posts: 219
Website

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 invalid

Please 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

#7 2010-04-27 08:45:17

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 115
Website

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

Board footer

Powered by FluxBB