Send Copy / Confirmation Email

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
stuarth
Posts: 2
Joined: Fri 14. Jan 2011, 15:21

Send Copy / Confirmation Email

Post by stuarth »

Hi all,

I'm dusting off my php knowledge and am trying to find out how to send a confirmation email after a user submits a form. They have to enter their email address into the form with has the name 'email'. This is all verified before the form is submitted so its down to the PHP surely? This is just a simple email saying 'thank you for registering' then the information they submitted.

Would it be possible just to create another act_formmailer.php i.e. act_formmailer2.php that the original HTML page and form can link to as well?

Currently using V1 and this is a quickfix until we find a more suitable contact system.

I'm happy setting up hidden HTML form elements and content but I don't want to mess about with the PHP code to much as I've already been chopping away at it to tweak other elements, any ideas?

Code: Select all

//checking for base values
//recipient, recipient name:
if(isset($_POST["recipient"])) {
	$recipient = trim($_POST["recipient"]);
	unset($_POST["recipient"]);
}
if(MailVal($recipient,2)) { //if recipient mail address is invalid
	$form_error[100] = $translate[$lang]["error100"];
}
if(isset($_POST["recipient_name"])) {
	$recipient_name = trim($_POST["recipient_name"]. $_POST["email"]);
	//$recipient_name_encoded = encode($recipient_name, $charset)
	unset($_POST["recipient_name"]);
}
//subject:
if(isset($_POST["subject"])) {
$subject = html_despecialchars(trim($_POST["subject"]. " - ". $_POST["ProductName"]. " ". $_POST["VersionNumber"]. " - ". $_POST["email"]));
	$subject_encoded = encode($subject, $charset);
	unset($_POST["subject"]);
}
if(isEmpty($subject)) { //if recipient mail address is invalid
	$form_error[200] = $translate[$lang]["error200"];
}
//send copy to form sender
if(isset($_POST["send_copy"])) {
	if(intval($_POST["send_copy"])) {
		$send_copy_to = trim($_POST["email"]);
		if(MailVal($send_copy_to, 2)) {
			$form_error[300] = $translate[$lang]["error300"];
			unset($send_copy_to);
		}
	}
	unset($_POST["send_copy"]);
}
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Send Copy / Confirmation Email

Post by Oliver Georgi »

do not use the old formmailer.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
stuarth
Posts: 2
Joined: Fri 14. Jan 2011, 15:21

Re: Send Copy / Confirmation Email

Post by stuarth »

:( well we're updating to a CMS in the coming months that will automate this in the future anyway and could really do with a quickfix solution?
Post Reply