Not receiving form details

Issues related to forms.
Post Reply
User avatar
DarrenH
 
 
Posts: 62
Joined: Thu Apr 10, 2008 9:31 am

Not receiving form details

Post by DarrenH » Tue Jun 04, 2019 2:40 pm

I have created a form in WB14.

The server supports php.

All pages built have the php extension.

I have built the form using the ready-made form wizard, but not receiving anything.

Any ideas/help please much appreciated.

User avatar
Pablo
 
Posts: 18756
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Not receiving form details

Post by Pablo » Tue Jun 04, 2019 3:58 pm

Did you try the suggestions from the FAQ?
http://www.wysiwygwebbuilder.com/forum/ ... 10&t=32967

User avatar
DarrenH
 
 
Posts: 62
Joined: Thu Apr 10, 2008 9:31 am

Re: Not receiving form details

Post by DarrenH » Tue Jun 04, 2019 4:06 pm

Thanks for the reply.

My server supports php.

This is the code generated:

myemail.yahoo.co.uk - that is not the real one - that has only been inserted for security reasons

<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'form1')
{
$mailto = 'myemail@yahoo.co.uk';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Website form';
$message = 'Values submitted from web site form:';
$success_url = '';
$error_url = '';
$error = '';
$eol = "\n";
$boundary = md5(uniqid(time()));

$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
$header .= 'X-Mailer: PHP v'.phpversion().$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}

if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}

$internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response");
$message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
$logdata = '';
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
$body .= $eol.stripslashes($message).$eol;
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
$body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
if ($mailto != '')
{
mail($mailto, $subject, $body, $header);
}
header('Location: '.$success_url);
exit;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Page</title>
<meta name="generator" content="WYSIWYG Web Builder 14 - http://www.wysiwygwebbuilder.com">
<link href="Untitled1.css" rel="stylesheet">
<link href="index.css" rel="stylesheet">
</head>
<body>
<div id="wb_Form1" style="position:absolute;left:131px;top:58px;width:457px;height:459px;z-index:5;">
<form name="contact" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" accept-charset="ISO-8859-1" target="_self" id="Form1">
<input type="hidden" name="formid" value="form1">
<label for="Editbox1" id="Label1" style="position:absolute;left:10px;top:15px;width:35px;height:16px;line-height:16px;z-index:0;">Name:</label>
<input type="text" id="Editbox1" style="position:absolute;left:63px;top:15px;width:190px;height:16px;z-index:1;" name="name" value="" spellcheck="false">
<label for="Editbox2" id="Label2" style="position:absolute;left:10px;top:46px;width:35px;height:16px;line-height:16px;z-index:2;">Email:</label>
<input type="text" id="Editbox2" style="position:absolute;left:63px;top:46px;width:190px;height:16px;z-index:3;" name="email" value="" spellcheck="false">
<input type="submit" id="Button1" name="" value="Send" style="position:absolute;left:63px;top:77px;width:96px;height:25px;z-index:4;">
</form>
</div>
</body>
</html>

I can't see anything wrong

User avatar
Pablo
 
Posts: 18756
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Not receiving form details

Post by Pablo » Tue Jun 04, 2019 5:05 pm

Everything is OK, expect that you did not set a success and error page.

If there is no error then please read:
"Emails are not arriving in my inbox."
http://www.wysiwygwebbuilder.com/forum/ ... 10&t=32967

User avatar
BaconFries
 
 
Posts: 4715
Joined: Thu Aug 16, 2007 7:32 pm

Re: Not receiving form details

Post by BaconFries » Tue Jun 04, 2019 5:11 pm

http://www.wysiwygwebbuilder.com/forum/ ... 10&t=32967
"Emails are not arriving in my inbox."
Many hosts/server do not allow the use of the likes of "Yahoo" email addresses and require it to be the host email address.
1. Did the emails end up in spam?
2. Maybe the emails were blocked by your ISP (yahoo and others may block it on the mail server)

User avatar
DarrenH
 
 
Posts: 62
Joined: Thu Apr 10, 2008 9:31 am

Re: Not receiving form details

Post by DarrenH » Wed Jun 05, 2019 9:07 am

Thanks, all sorted now. Script was fine. My mistake :oops:

Post Reply