Copy link to clipboard
Copied
Hi,
I am having a major problem getting my email forms to work via my server my website Registration and Contact pages are both constructed in Dreamweaver CC using the FormMail Post method code. The server I'm using is Crazy Domains to host my site. They do have php available. I have a php file in their cgi-bin folder to work the backend but this file may not be configured correctly as I keep receiving the 500 error codes when I test sending the form from my website via internet. I was hoping someone will be able to help me get my forms working properly to receive the enquiries to my emails inbox. I'm using a MacBook pro mid 2012 which handles the Dreamweaver program nicely. Website pages: www.reikiempowermentseminars.com.au/assets/contact.html www.reikiempowermentseminars.com.au/assets/registration.html
Here is the code I'm using for the post form method.
<form action=https://www.reikiempowermentseminars.com.au/cgi-bin/testemail-1.php
method="post" onsubmit="processForm(this);return false" name="enroll" id="enroll"><div id="treatmentcontact" class="fluid">
<div><input name="recipient" type="hidden" id="recipient" value="dezdalton@reikiempowermentseminars.com.au" />
<input type="hidden" name="subject" id="subject" value="REIKI TREATMENT ENQUIRY" />
<input name="redirect" type="hidden" id="redirect" value="https://www.reikiempowermentseminars.com.au/assets/thankyoupage.html" /></div>
The php file in the cig-bin/testemail-1.php is on the cpanel remote server.
Here's the php code
<?php
// THE BELOW LINE STATES THAT IF THE SUBMIT BUTTON
// WAS PUSHED, EXECUTE THE PHP CODE BELOW TO SEND THE
// MAIL. IF THE BUTTON WAS NOT PRESSED, SKIP TO THE CODE
// BELOW THE "else" STATEMENT (WHICH SHOWS THE FORM INSTEAD).
if ( isset ( $_POST [ 'buttonPressed' ] )){
// REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS.
$to = 'dezdalton@reikiempowermentseminars.com.au' ;
$subject = 'From PHP contact page' ;
// NOT SUGGESTED TO CHANGE THESE VALUES
$message = $_POST [ "message" ] ;
$headers = 'From: ' . $_POST[ "from" ] . PHP_EOL ;
mail ( $to, $subject, $message, $headers ) ;
// THE TEXT IN QUOTES BELOW IS WHAT WILL BE
// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.
echo "Your e-mail has been sent! You should receive a reply within 24 hours!" ;}
else{
?>
<form method= "post" action= "<?php echo $_SERVER [ 'PHP_SELF' ] ;?>" />
<table>
<tr>
<td>Your e-mail address: </td>
<td><input name= "from" type= "text"/></td>
</tr>
<tr>
<td>Your message: </td>
<td><textarea name= "message" cols= "20" rows= "6"></textarea></td>
</tr>
<tr>
<td></td>
<td><input name= "buttonPressed" type= "submit" value= "Send E-mail!" /></td>
</tr>
</table>
</form>
<?php } ?>
Please advise if there is something missing or not configured correctly here.
Thanks for your kind help and assistance. Dez
Copy link to clipboard
Copied
Which form processing script does your host recommend you use? Also find out if your hosting plan supports the PHP mail () function to send mail. If ti doesn't, you'll need to find a script that uses SMTP instead.
Copy link to clipboard
Copied
Hi Nancy,
Many thanks for your great advice!
I feel that I'm getting closer to having my forms functioning properly.
My hosting plan supports PHP mail functionality in sending mail. They said I'll need to use an SMTP for it to work. Refer this link below on how to use PHP mailer for their hosting.
https://www.crazydomains.com.au/help/how-to-add-phpmailer-for-linux-and-windows-hosting/
Is this difficult process to configure and set up?
Thx, Dez
Copy link to clipboard
Copied
The file that you are using as the action file, testemail-1.php contains the code that should be used in your main document.
In other words, scrap
<form action=https://www.reikiempowermentseminars.com.au/cgi-bin/testemail-1.php
method="post" onsubmit="processForm(this);return false" name="enroll" id="enroll"><div id="treatmentcontact" class="fluid">
<div><input name="recipient" type="hidden" id="recipient" value="dezdalton@reikiempowermentseminars.com.au" />
<input type="hidden" name="subject" id="subject" value="REIKI TREATMENT ENQUIRY" />
<input name="redirect" type="hidden" id="redirect" value="https://www.reikiempowermentseminars.com.au/assets/thankyoupage.html" /></div>
and replace with
<?php
// THE BELOW LINE STATES THAT IF THE SUBMIT BUTTON
// WAS PUSHED, EXECUTE THE PHP CODE BELOW TO SEND THE
// MAIL. IF THE BUTTON WAS NOT PRESSED, SKIP TO THE CODE
// BELOW THE "else" STATEMENT (WHICH SHOWS THE FORM INSTEAD).
if ( isset ( $_POST [ 'buttonPressed' ] )){
// REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS.
$to = 'dezdalton@reikiempowermentseminars.com.au' ;
$subject = 'From PHP contact page' ;
// NOT SUGGESTED TO CHANGE THESE VALUES
$message = $_POST [ "message" ] ;
$headers = 'From: ' . $_POST[ "from" ] . PHP_EOL ;
mail ( $to, $subject, $message, $headers ) ;
// THE TEXT IN QUOTES BELOW IS WHAT WILL BE
// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.
echo "Your e-mail has been sent! You should receive a reply within 24 hours!" ;}
else{
?>
<form method= "post" action= "<?php echo $_SERVER [ 'PHP_SELF' ] ;?>" />
<table>
<tr>
<td>Your e-mail address: </td>
<td><input name= "from" type= "text"/></td>
</tr>
<tr>
<td>Your message: </td>
<td><textarea name= "message" cols= "20" rows= "6"></textarea></td>
</tr>
<tr>
<td></td>
<td><input name= "buttonPressed" type= "submit" value= "Send E-mail!" /></td>
</tr>
</table>
</form>
<?php } ?>
Edit: You are using HTTPS to serve the website, therefore you should also use HTTPS links to the web site. See your code for http://www.modernizr.com/
Copy link to clipboard
Copied
Hi Ben,
Thanks for your recommendations. Although I'm unable to locate the http://modernizr.com file on my local site that you mentioned? I agree if I'm running ssl domain certificate all URL's need to be compliant.
Unfortunately I'm still receiving the 500 error for the contact.html form page. Thank you, Dez
Copy link to clipboard
Copied
Hi Nancy,
My issue still persisting!
I'm still experiencing a 500 error when I test my contact form for www.reikiempowermentseminars.com.au/contact.html page the error I receive is
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@reikiempowermentseminars.com.au to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
My remote hosting server state that this a coding issue on my local dreamweaver program.
When you look at the page you'll see that I kept the java script in order to run the form enter requirement behaviours.
I have the php file in my local dreamweaver page contact.html file. Do you have any further suggestions?
Thx, Dez
Copy link to clipboard
Copied
Most servers don't allow PHP scripts to run in ordinary HTML files. You would need to rename contact.html to contact.php.
Copy link to clipboard
Copied
Hi Nancy,
Thanks for the tip, I wasn't aware of that. As you suggested I've changed the contact.html to contact.php uploaded ammended file to the server. I've tested the form which is still coming up with the same 500 internal error.
Copy link to clipboard
Copied
Do us a simple test. Copy the php block of code below and insert it in a completely blank Dreamweaver document, no doctype tags, just a blank file. Save it as test.php then upload it to your server where the rest of your files are usually uploaded to and then call the file from your remote host in your browser.
Change the $recipient to YOUR email address. Change the $sender to someone@yourDomainName.com where yourDomaiName.com is YOUR website domain name. See if you get a response. Im trying to establish if your host supports the php mail() function or whether you need to use a different approach to receive the mail.
<?PHP
$sender = 'someone@somedomain.tld';
$recipient = 'you@yourdomain.tld';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers))
{
echo "Message accepted";
}
else
{
echo "Error: Message not accepted";
}
?>
Copy link to clipboard
Copied
I thought the host said the OP must use SMTP authentication.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Nancy+OShea wrote
I thought the host said the OP must use SMTP authentication.
I never really believe what hosts say because they usually just tell you what you want to hear, an answer to your problem, whether its correct or incorrect.
Crazy hosts also has a formmail script
Using PHP FormMail - Support | CrazyDomains.com.au
I don't know what kind of server the OPs website is hosted on so if we can establish the server doesn't send a very simple mail() function that at least negates that angle.
Has the OP even give Bens solution a trial, post 3. I don't know as they are not revealing anything useful which will allow for any further guidance, beyond guessing.
Copy link to clipboard
Copied
Hi Osgood, Thanks for your input to assist in with getting my forms to work. I agree, the Host server have been no help at all instead saying the problem is the local coding problem .... me! Thanks for the remote server tip. I'll create the simple PHP form and upload to Crazy domains to see if it gets accepted. Yes, your correct it seems to be all guess work at the moment.
Copy link to clipboard
Copied
Yes Nancy host provider Crazy Domains said they accept email forms through SMTP. But I'm not sure how to do this in my contact file?
Copy link to clipboard
Copied
Hi Osgood,
Amazing! after creating blank page then uploading the script I just got a blank php file with https://www.reikiempowermentseminars.com.au/test7.php
What do you recommend from here?
Copy link to clipboard
Copied
I decided to do what Nancy suggested and change the contact.html form to contact.php. After uploading it. It was totally blank no text or form whatsoever. So I returned it back to html form and again tested out the form and got the 500 internal error page again!. If you want to see the code in a browser developer the page in question is www.reikiempowermentseminars.com.au/contact.html I would really like to get my forms working for people to contact via my website forms. Any clues to why I'm unable to do this please? Is it something that I'm doing wrong with the code on my local dreamweaver page? All other pages are fine. Please advise.
Copy link to clipboard
Copied
Oops the correct page is https://www.reikiempowermentseminars.com.au/assets/contact.html
Copy link to clipboard
Copied
https://forums.adobe.com/people/Dez+Dalton wrote
Oops the correct page is https://www.reikiempowermentseminars.com.au/assets/contact.html
Its no good using .html If you have <?php ?> code in your html file, that wont work.
IF you do not paste or write the php absolutely correct, there is zero room for error, your page will be blank
Copy link to clipboard
Copied
https://forums.adobe.com/people/Dez+Dalton wrote
Hi Osgood,
Amazing! after creating blank page then uploading the script I just got a blank php file with https://www.reikiempowermentseminars.com.au/test7.php
What do you recommend from here?
That would indicate to me something is not right if you are just seeing a blank page.
Can you do something else:
Copy the line of php code below and again paste into a new blank Dreamweaver document, save as hello_world.php - upload to your server and browse to it. If php is working on your sever you will see a message 'Hello World'
<?php echo "Hello World"; ?>
First we need to establish your server is enabled for processing php
It should be ok as your website is hosted on an Apache server
Copy link to clipboard
Copied
Hi Osgood,
Success! The Hello World has appeared!
Copy link to clipboard
Copied
https://forums.adobe.com/people/Dez+Dalton wrote
Hi Osgood,
Success! The Hello World has appeared!
So can you now test the code below again. Change the $recipient email address to the email address where you can check to see if any information has been sent back.
Save as - test_form.php
<?php
$sender = 'someone@somedomain.ltd';
$recipient = 'you@youremailaddress.com';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
mail($recipient, $subject, $message, $headers);
echo "mail sent";
?>
Copy link to clipboard
Copied
Hi Osgood, I put the php code into the hello_world.php file. But the www.reikiempowermentseminars.com.au/hello_world.php nothing appears on the browser same blank page. I pasted below the <body> it still did not work.
Here's the code from the php file for your perusal.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
<?php
// THE BELOW LINE STATES THAT IF THE SUBMIT BUTTON
// WAS PUSHED, EXECUTE THE PHP CODE BELOW TO SEND THE
// MAIL. IF THE BUTTON WAS NOT PRESSED, SKIP TO THE CODE
// BELOW THE "else" STATEMENT (WHICH SHOWS THE FORM INSTEAD).
if ( isset ( $_POST [ 'buttonPressed' ] )){
// REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS.
$to = 'dezdalton@reikiempowermentseminars.com.au' ;
$subject = 'From PHP contact page' ;
// NOT SUGGESTED TO CHANGE THESE VALUES
$message = $_POST [ "message" ] ;
$headers = 'From: ' . $_POST[ "from" ] . PHP_EOL ;
mail ( $to, $subject, $message, $headers ) ;
// THE TEXT IN QUOTES BELOW IS WHAT WILL BE
// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.
echo "Your e-mail has been sent! You should receive a reply within 24 hours!" ;}
else{
?>
<form method= "post" action= "<?php echo $_SERVER [ 'PHP_SELF' ] ;?>" />
<div id="tablediv1" class="fluid ">
<table width="21%" align="center" cellspacing="3" cellpadding="5" bordercolor="">
<tbody>
<tr>
<td></td>
<td><span style="color: #FF0000">• </span>REQUIRED</td>
</tr>
<th scope="col"> </th>
<th scope="col"><select name="REQUEST TREATMENT" id="Contact">
<option>REQUEST A REIKI TREATMENT </option>
<option>REIKI TREATMENT</option>
<option>GIFT VOUCHER</option>
</select></td>
</tr>
<td><span style="color: #FF0000">• </span> </td>
<td><input name="CUSTOMER NAME" type="text" id="name2"
onfocus="clearDefault(this)"
onblur="//MM_validateForm('realname','','R');//return document.MM_returnValue"
value="Enter first & Last Name" size="25"
maxlength="40" /></td>
</tr>
<tr>
<td><span style="color: #FF0000">• </span> </td>
<td><input name="email" type="text" id="email"
onblur="//MM_validateForm('Email','','RisEmail');//return document.MM_returnValue"
onfocus="clearDefault(this)"
value="Enter Email Address" size="25" /></td>
</tr>
<tr>
<td><span style="color: #FF0000">• </span></td>
<td><input name="PHONE" type="text" id="contact"
onfocus="clearDefault(this)"
value="Enter Phone Number" size="25" /></td>
</tr>
<tr>
<td></td>
<td><select name="PREFERRED SESSION" id="Session">
<option>REIKI TREATMENT PREFERENCE </option>
<option value="30 min ~chakra balance">30 MIN ~ CHAKRA BALANCE</option>
<option value="60 min ~ treatment">60 MIN ~ TREATMENT</option>
<option value="90 min treatment">90 MIN TREATMENT</option>
<option value="2hr full body bliss">2hr FULL BODY BLISS</option>
<option value="3hr empower+light">3hr EMPOWER+LIGHT</option>
</select></td>
</tr>
<tr>
<td></td>
<td>Newsletter Request</td>
</tr>
<tr>
<td></td>
<td>
<label>
<input type="radio" name="Newsletter" value="Yes" id="NEWSLETTER">
Yes</label>
<br>
<label>
<input type="radio" name="Newsletter" value="No" id="NEWSLETTER">
No</label>
<br>
</td>
</tr>
<tr>
<td> </td>
<td><textarea name="SESSION DATE REQUEST" cols="34" rows="3" wrap="virtual" id="Question" onfocus="clearDefault(this)">Enter Reiki Treatment Date/Time Request:</textarea></td>
</tr>
<tr>
<td></td>
<td><input name= "buttonPressed" type= "submit" value= "Send Enquiry!" /></td>
</tr>
</table>
</form>
</div>
<?php } ?>
<body>
</body>
</html>
Copy link to clipboard
Copied
Try the code below, yours is a bit mangled. Change the line of XXXXXXXXXXXXXXXXXXXXXXXXX to your email address. You should not post email addresses in the forum as they are feed for spam harvesters.
The form isn't going to do anything yet but it might be visible instead of the blank page you keep encountering.
<?php
if(isset($_POST['send_enquiry'])){
$to = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ;
$subject = 'From PHP contact page' ;
$request_treatment = $_POST["request_treatment"];
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$preferred_session = $_POST["preferred_session"];
$newsletter = $_POST["newsletter"];
$session_date_request = $_POST["session_date_request"];
$headers = 'From: ' . $_POST[ "from" ] . PHP_EOL ;
mail ($to, $subject, $message, $headers ) ;
$response = "Your e-mail has been sent! You should receive a reply within 24 hours!";
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>FeedbackForm</title>
<style>
.feedback_form {
width: 40%;
margin: 0 auto;
}
.customer_name, .email, .phone, .session_date_request {
width: 100%;
padding: 8px;
}
</style>
</head>
<body>
<div class="feedback_form">
<?php if(isset($response)) {
echo $response;
}
?>
<form method= "post" action= "<?php echo $_SERVER [ 'PHP_SELF' ] ;?>" />
<p>
<select name="request_treatment" class="request_treatment">
<option>REQUEST A REIKI TREATMENT </option>
<option>REIKI TREATMENT</option>
<option>GIFT VOUCHER</option>
</select>
</p>
<p>
<input type="text" name="customer_name" class="customer_name" value="Enter First & Last Name">
</p>
<p>
<input type="text" name="email" class="email" value="Enter Email Address">
</p>
<p>
<input type="text" name="phone" class="phone" value="Enter Phone Number">
</p>
<p>
<select name="preferred_session" class="preferred_session">
<option>REIKI TREATMENT PREFERENCE</option>
<option value="30 min ~chakra balance">30 MIN ~ CHAKRA BALANCE</option>
<option value="60 min ~ treatment">60 MIN ~ TREATMENT</option>
<option value="90 min treatment">90 MIN TREATMENT</option>
<option value="2hr full body bliss">2hr FULL BODY BLISS</option>
<option value="3hr empower+light">3hr EMPOWER+LIGHT</option>
</select>
</p>
<p>Newsletter Request</p>
<label for="yes">
<input type="radio" name="newsletter" value="Yes" id="yes" >Yes
</label>
<label for="no">
<input type="radio" name="newsletter" value="No" id="no" >No
</label>
<p>
<textarea name="session_date_request" class="session_date_request" cols="34" rows="3" >Enter Reiki Treatment Date/Time Request:</textarea>
</p>
<p>
<input type= "submit" name="send_enquiry" value="Send Enquiry!">
</p>
</form>
</div>
<!-- end feedbackform -->
</body>
</html>
Copy link to clipboard
Copied
Okay thanks for tip not to put email addresses in my adobe enquiry pages to the community.
I copied and pasted your code into my dreamweaver hello_world.php test page and accused it through my server and it is completely blank again! Any other suggestions?
Copy link to clipboard
Copied
Could this have anything to do with files permissions on the server. When I FTP the php file via dreamweaver the file is set at 0600 permission. Still wondering why I receive the blank php page on the internet remote server?
Copy link to clipboard
Copied
Please post a link to the contact form web page so that e can se what is going on.