Email Form Generator / Email Formulargenerator reply feature

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
thoblerone@work
Posts: 8
Joined: Fri 3. Feb 2006, 14:55
Location: Sprockhövel, Germany
Contact:

Email Form Generator / Email Formulargenerator reply feature

Post by thoblerone@work »

Hello folks,

quite some of you may have noticed that the email form generator sends emails to your inbox with the from header code you have specified in the pwpwcms config. Unfortunately if you just hit the reply button of your email client your customer won't see the email ... I set up the system that the form email sender is me so I will send the answer to myself and feel silly :oops:

For those of you that have asked, here a quick hack:

1.
Set up your email form generator that the email that is entered by the customer is in a field that is called 'email', e.g. like this

Code: Select all

IT|Name|0|Titel/Vorname/Name: |40,100||300
IT|Firma|0|Firma: |40,100||300
IT|Strasse|0|Straße: |40,100||300
IT|PLZOrt|0|PLZ/Ort: |40,100||300
IT|Telefon|0|Telefon: |40,100||300
IT|Fax|0|Fax: |40,100||300
IT|email|0|E-Mail: |40,100||300
TA|Nachricht|0|Ihre Nachricht: |40,10||300
IC|Newsletter|0|Newsletter: |300,0|Bitte senden Sie mir ihren Newsletter|0
IH|redirect|0||10,100|http://www.yourdomain.de/index.php?frmsuccess|0
IH|redirect_error|0||10,100|http://www.yourdomain.de/index.php?frmerror|0
2.
Look for, find and open the file /include/inc_act/act_formmailer.php
Go to the line 230 (plus/minus a few lines). You'll find these very eye-catching lines:

Code: Select all

	$body.= "\n====================================================================\n";
	$body.= "phpwcms formmailer  | Copyright (C) 2003 \n";
	
	// phpMailer Class
	$mail = new PHPMailer();
	$mail->Mailer 			= $phpwcms['SMTP_MAILER'];
	$mail->Host 			= $phpwcms['SMTP_HOST'];
	$mail->Port 			= $phpwcms['SMTP_PORT'];
	if($phpwcms['SMTP_AUTH']) {
		$mail->SMTPAuth 	= 1;
		$mail->Username 	= $phpwcms['SMTP_USER'];
		$mail->Password 	= $phpwcms['SMTP_PASS'];
	}
	$mail->SMTPKeepAlive 	= true;
	$mail->CharSet	 		= $phpwcms["charset"];
	$mail->IsHTML(0);
	$mail->Subject			= $subject;
	$mail->Body 			= $body;
3.
After the $mail->Body line, add this code

Code: Select all

	/* TB reply-to Funktionalität */
	if(isset($_POST["email"])) {
		$mail->AddReplyTo($_POST["email"]);
	}
	/* TB Ende */
4.
Save the changes. Before uploading the modified file, make sure to have a backup copy of the original, just for the case. (You will only need this backup file if you don't make the backup :D )

That's it. Give it a try. Remember that you possibly have to change your email contact form that the senders adress is entered in a field that has the exact name 'email' (lower case, no quotation marks).

Regards
Thomas Blenkers
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

You should not use act_formmailer.php anymore.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
frenzal
Posts: 17
Joined: Fri 17. Mar 2006, 17:17
Location: Belgium
Contact:

Post by frenzal »

the same logic can be applied to the other form script, i did something similar, now if i use a form element called email it will be used as reply address
Post Reply