Sunday 13 November 2016

Form to Email PHP Contact Form 000 WEB HOSTING


------------------------------------------------------------------------------------------------------------------
BEFORE SEND MESSAGE
1) FIRST SOVLE SMTP PROBLEM 
SMTP AUTHENTICATION EXCEPTION IN VB
2)  IMAP ENABLED
3) CORRECT GMAIL ADDRESS IN CODE
4) CORRECT THIS GMAIL PASSWORD IN CODE

------------------------------------------------------------------------------------------------------------------
USEFUL IMAGES:
https://www.google.com/settings/security/lesssecureapps
https://mail.google.com/mail/u/0/#settings/fwdandpop
------------------------------------------------------------------------------------------------------------------
https://www.google.com/settings/security/lesssecureapps

https://mail.google.com/mail/u/0/#settings/fwdandpop


------------------------------------------------------------------------------------------------------------------
Index.html   CODE
------------------------------------------------------------------------------------------------------------------
<form name="contactform" method="post" action="https://fbigadgets.000webhostapp.com/Mail.php">
<!-- NEED PHP HOSTING FOR Mail.php FILE -->
<table width="450px">
<tr>
<td valign="top">
<label for="first_name">First Name *</label>
</td>
<td valign="top">
<input  type="text" name="first_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top"">
<label for="last_name">Last Name *</label>
</td>
<td valign="top">
<input  type="text" name="last_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email Address *</label>
</td>
<td valign="top">
<input  type="text" name="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone">Telephone Number</label>
</td>
<td valign="top">
<input  type="text" name="telephone" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="comments">Comments *</label>
</td>
<td valign="top">
<textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">   <a href="http://www.freecontactform.com/email_form.php">Email Form</a>
</td>
</tr>
</table>
</form>

------------------------------------------------------------------------------------------------------------------
MUST BE LOG IN ACCOUNT 000WEBHOSTING  FOR RUN PHP FILE
Mail.php   CODE
NEED PHP FILE HOSTING FOR Mail.php  
UPLOAD PHP FILE IN PUBLIC HTML FOLDER IN 000WB HOSTING
USE GMAIL WITH  ENABLE IMAP SETTING
REPLACE MY GMAIL TO YOUR GMAIL 
------------------------------------------------------------------------------------------------------------------
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "ayeshahttp@gmail.com";
$email_subject = "FBGadgets";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');      
}
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>

---------------------------------------------------------------------------------------------------------
OR USE CONTACT FORM WITHOUT HTML CODE
Mail.php   CODE
NEED PHP FILE HOSTING FOR Mail.php  
UPLOAD PHP FILE IN PUBLIC HTML FOLDER IN 000WB HOSTING
USE GMAIL WITH  ENABLE IMAP SETTING

REPLACE MY GMAIL TO YOUR GMAIL 
http://www.123contactform.com/simple-php-contact-form.html
-----------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------
<?php
$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<form  action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Your name:<br>
<input name="name" type="text" value="" size="30"/><br>
Your email:<br>
<input name="email" type="text" value="" size="30"/><br>
Your message:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Send email"/>
</form>
<?php
}
else  /* send the submitted data */
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
if (($name=="")||($email=="")||($message==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
else{      
$from="From: $name<$email>\r\nReturn-path: $email";
$subject="Message sent using your contact form";
mail("ayeshahttp@gmail.com", $subject, $message, $from);
echo "Email sent!";
}
} 
?>


---------------------------------------------------------------------------------------------------------














10 comments:

  1. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.
    our speed

    ReplyDelete
  2. Nice post. I was checking constantly this blog and I am impressed! Extremely helpful information specially the last part I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck.
    web hosting

    ReplyDelete
  3. crash-bandicoot-prepares-to-attack-smartphones
    https://www.sdesigndotcom.com/2020/02/crash-bandicoot-prepares-to-attack-smartphones.html

    ReplyDelete
  4. This is really a nice and informative. containing all information and also has a great impact on the new technology. Thanks for sharing it
    IT Support Company

    ReplyDelete
  5. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...
    hospedagem de site e email

    ReplyDelete
  6. Thank you again for all the knowledge you distribute.Good post. I was very interested in the article. it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job. I greatly appreciate that.Do Keep sharing! Regards.
    How to Block Emails With Gmail

    ReplyDelete
  7. Nice Informative Blog having nice sharing..
    hosting

    ReplyDelete
  8. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
    label designs free download

    ReplyDelete
  9. Man's lives, such as uncontrolled huge amounts, definitely not while countries furthermore reefs, challenging to seismic disturbance upward perfect apply. best-broken-link-checker

    ReplyDelete
  10. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much.
    website design

    ReplyDelete

FB Gadgets | Template Designed by Fatakat PhotosCoolBThemes.com
Code by : paid web directory

https://www.google.co.uk/search?q=site%3Ablogspot.com+fbgadgets