PDA

View Full Version : Auto-response to e-mail from registry form?



editorfcm
12-02-2005, 04:22 PM
Hi all


I need your help again I'm afraid.
I have created a form using Blue Voda. People must register their details first before they view my magazine. The problem I have is some people have to wait a few hours until I pick up the message and add them to the password protect file. I want to try and avoid this so I thought that when the click submit on my form an auto response e-mail will be sent to them with a monthly username and password. The problem there is that I need the auto-response to go to the e-mail that was entered in the field on my registry form. Any idea's on how I can do this???

Regards


Chris

navaldesign
12-03-2005, 08:22 PM
Hi all


I need your help again I'm afraid.
I have created a form using Blue Voda. People must register their details first before they view my magazine. The problem I have is some people have to wait a few hours until I pick up the message and add them to the password protect file. I want to try and avoid this so I thought that when the click submit on my form an auto response e-mail will be sent to them with a monthly username and password. The problem there is that I need the auto-response to go to the e-mail that was entered in the field on my registry form. Any idea's on how I can do this???

Regards


Chris

If your registry form has a separete thankyou page, you can include this password in your thankyou page

navaldesign
12-09-2005, 11:02 PM
Hi all


I need your help again I'm afraid.
I have created a form using Blue Voda. People must register their details first before they view my magazine. The problem I have is some people have to wait a few hours until I pick up the message and add them to the password protect file. I want to try and avoid this so I thought that when the click submit on my form an auto response e-mail will be sent to them with a monthly username and password. The problem there is that I need the auto-response to go to the e-mail that was entered in the field on my registry form. Any idea's on how I can do this???

Regards


Chris


The solution I'm proposing here can only work with single fields in order to be able to make the validation of the fields. So I'm giving you a script that should work. Please remember to set the form Action to feedback.php Set the enctype to multipart/form-data. To create the feedback.php page have a look at http://www.vodahost.com/vodatalk/showthread.php?t=933 (http://www.vodahost.com/vodatalk/showthread.php?t=933) (Thanks Pablo, it's been a valuable tip) . It's the same procedure but with the code i'm giving you:

Create the php page using BlueVoda:

Create a new page with BlueVoda and save is as 'feedback.bvp'.
Select View->Page HTML from the menu
Select the Inside Body tag and enter this code:


<?php

// Getting the variables from your form. The names must be the same as the field //names in your form. If you wish add or remove variables, depending on your form

@$Answerway = addslashes($_POST['Aswerway']);

@$Site = addslashes($_POST['Site']);

@$Position = addslashes($_POST['Position']);

@$Company = addslashes($_POST['Company']);

@$Text = addslashes($_POST['Text']);

@$How_did_you_find_us = addslashes($_POST['How_did_you_find_us']);

@$Country = addslashes($_POST['Country']);

@$State = addslashes($_POST['State']);

@$City = addslashes($_POST['City']);

@$Address = addslashes($_POST['Address']);

@$Last_name = addslashes($_POST['Last_nane']);

@$Name = addslashes($_POST['Name']);

@$Email = addslashes($_POST['Email']);

@$Mobile = addslashes($_POST['Mobile']);

@$Telephone = addslashes($_POST['Telephone']);

@$Fax = addslashes($_POST['Fax']);

@$Priority = addslashes($_POST['Priority']);

@$upload1_Name = $_FILES['upload1']['name'];

@$upload1_Size = $_FILES['upload1']['size'];

@$upload1_Temp = $_FILES['upload1']['tmp_name'];

@$upload1_Mime_Type = $_FILES['upload1']['type'];

function RecursiveMkdir($path)

{

if (!file_exists($path))

{

RecursiveMkdir(dirname($path));

mkdir($path, 0777);

}

}



// Validation of email field

if (strlen($Email) == 0 )// check the $Email lenght to make sure that the field is not empty

{

header("Location: error_email.html"); //error_email.html is the error page relative to wrong email input

exit;

// At this point insert the code from "if" ..... to "exit;" changing the $Email to $Name or whatever else in order to check if a specific field is filled in. If you want create also error_name.html page and so on



if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))

{

header("Location: error_email.html");// error_email.html is the error page relative to wrong email input

exit;

}

// Validation of filesize - change 5000000 (5 MB) to whatever you wish

if( $upload1_Size >5000000)

{

//delete file

unlink($upload1_Temp);

header("Location: error_file_size.html");// error_file_size.html is the error page relative to wrong filesize

exit;

}

// Validation of filetype - If you need more types contact me

if( $upload1_Mime_Type != "application/msword" AND $upload1_Mime_Type != "application/pdf" AND $upload1_Mime_Type != "application/rtf" AND $upload1_Mime_Type != "application/vnd.ms-excel" AND $upload1_Mime_Type != "application/vnd.ms-powerpoint" AND $upload1_Mime_Type != "application/vnd.ms-project" AND $upload1_Mime_Type != "application/vnd.ms-works" AND $upload1_Mime_Type != "application/xml" AND $upload1_Mime_Type != "application/xml-dtd" AND $upload1_Mime_Type != "application/xml-external-parsed-entity" AND $upload1_Mime_Type != "application/zip" AND $upload1_Mime_Type != "audio/mpeg" AND $upload1_Mime_Type != "image/cgm" AND $upload1_Mime_Type != "image/g3fax" AND $upload1_Mime_Type != "image/gif" AND $upload1_Mime_Type != "image/ief" AND $upload1_Mime_Type != "image/pjpeg" AND $upload1_Mime_Type != "image/png" AND $upload1_Mime_Type != "image/prs.btif" AND $upload1_Mime_Type != "image/tiff" AND $upload1_Mime_Type != "image/vnd.dwg" AND $upload1_Mime_Type != "image/vnd.dxf" AND $upload1_Mime_Type != "text/" AND $upload1_Mime_Type != "text/calendar" AND $upload1_Mime_Type != "text/css" AND $upload1_Mime_Type != "text/directory" AND $upload1_Mime_Type != "text/enriched" AND $upload1_Mime_Type != "text/html" AND $upload1_Mime_Type != "text/parityfec" AND $upload1_Mime_Type != "text/plain" AND $upload1_Mime_Type != "text/richtext" AND $upload1_Mime_Type != "text/rtf" AND $upload1_Mime_Type != "text/sgml" AND $upload1_Mime_Type != "text/tab-separated-values" AND $upload1_Mime_Type != "text/uri-list" AND $upload1_Mime_Type != "text/xml" AND $upload1_Mime_Type != "video/mpeg" AND $upload1_Mime_Type != "video/parityfec" AND $upload1_Mime_Type != "video/pointer" AND $upload1_Mime_Type != "video/quicktime" AND $upload1_Mime_Type != "video/vnd.fvt" )

{

unlink($upload1_Temp);

header("Location: error_file_type.html");// error_file_type.html is the error page relative to wrong filetype

exit;

}

$uploadFile = "uploads/".$upload1_Name ;//uploads is the uploading directory, in the same directory as the script

if (!is_dir(dirname($uploadFile)))

{

@RecursiveMkdir(dirname($uploadFile));

}

else

{

@chmod(dirname($uploadFile), 0777);

}

@move_uploaded_file( $upload1_Temp , $uploadFile);

chmod($uploadFile, 0644);

$upload1_URL = "http://www.yourdomain.com/uploads/".$upload1_Name ;

//Sending Email to form owner

$pfw_header = "From: $Email\n"

. "Reply-To: $Email\n";

$pfw_subject = "Data submitted from FeedbackForm";// Change the title to whatever you wish

$pfw_email_to = "youremail@yourdomain.com, youremail1@yourdomain.com";//add all the emails, separated by commas

$pfw_message = "Modalita_Risposta: $Modalita_Risposta\n"

. "Site: $Site\n"

. "Position : $Position\n"

. "Company: $Company\n"

. "Text: $Text\n"

. "How_did_you_find_us: $How_did_you_find_us\n"

. "Country: $Country\n"

. "State: $State\n"

. "City: $City\n"

. "Address: $Address\n"

. "Last_name: $Last_name\n"

. "Name: $Name\n"

. "Email: $Email\n"

. "Mobile: $Mobile\n"

. "Telephone: $Telephone\n"

. "Fax: $Fax\n"

. "Priority: $Priority\n"

. "upload1: $upload1_URL\n";

*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

//Sending auto respond Email to visitor

$pfw_header = "From: youremail@yourdomain.com\n"

. "Reply-To: youremail@yourdomain.com\n";

$pfw_subject = "Contact Confirmation";

$pfw_email_to = "$Email";

$pfw_message = "Thankyou for your submission. We shall get back to you as soon as possible.";//put your password in this text.

*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

header("Location: thankyou_page.html");

?>





Don't do any formatting of the page. The script will automatically take you to the thankyou_page.html. In this page you can have a menubar or a button or something to get you from there to wherever you want, or you can include a "Refresh" command to automaticaly take you to another page after some seconds.
Select View->Page Properties from the menu
Set the file extension to php
Publish the page feedback.bvp to your VodaHost account.
At this point you have your form and the feedback.php page that will proccess the form.


Please read the script carefully. There are many things you have to change to have it changed to your needs.

By the way: test the form in http://www.navaldesign.info/feedback13.html (http://www.navaldesign.info/feedback13.html)

and the auxiliary pages in:

http://www.navaldesign.info/error_email.html
http://www.navaldesign.info/error_file_type.html
http://www.navaldesign.info/error_file_size.html
http://www.navaldesign.info/thankyou_page.html

If you have any problems please let me know.

alegmoni
03-21-2006, 10:14 PM
Dear Navaldesign

Thank you on all your info on forms and php script. I used it and the mail work except for one part.

The from part of the mail is blank, hence cant use the reply function in my email program to quick respond to the sender.

Script used:

<?PHP $email = $HTTP_POST_VARS[email];
$mailto = "?????????@mweb.com.na";
$mailsubj = "Reservation Availability";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from availability form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>

Regards
Andries

navaldesign
03-22-2006, 05:31 AM
Most probably you have named the email field of your form something else than "email". If you read the script carefully, you will see that the script will "grab" the email address only if the fiels is named "email". If it is called "Email" or "email address" or even "email " (this last one has a blank space after the word email) it will not work. You do get the email in the body, because there you get ALL the form fields.