WYSIWYGWebbuilder & Form Wizard-Email

lennyboy

New Member
Messages
37
Reaction score
0
Points
0
Hi,

I don't have the page in questioned linked to anything right now, but I'm having troubles getting an email form to get to me. It's at:

http://lenford.info/page4.php

When you fill out the form correctly and submit, it takes you to the success page. If you enter your email incorrectly, it takes you to the error page. However, when filling out the form and it looks successful, it isn't getting to me.

I had read that you needed to use your x10 email address, so I made one that I could forward to my lenford.info account. Nothing is hitting either.

I'm using WYSIWYGWebbuilder V.6, and everything else is working great. I'm not sure if I need to tweak something on the form page to make it work or not. Can someone look at it and see what/where/if I've gone wrong with this?

TIA; this is a great place, by the way.
Edit:
I just received an email form from Mr. EEE, but for some odd reason, I can't send one to myself using the web form.

Now THAT's weird!
 
Last edited:

ChatIndia

Community Advocate
Community Support
Messages
1,408
Reaction score
30
Points
48
Why don't you try to store it in your database, and if you succeed to do it, then please give me the code, I'm having the same problem
 

xgreenberetx

New Member
Messages
57
Reaction score
1
Points
0
Hope this helps, if not post your script and i can fix it. There are many ways to do this. Of coarse change the email to reflect your email

Code:
$subject = "Contact Form Entry";                          
$toemail = "youremail@email.com";        

if($submit) 
{ 
mail($toemail, $subject, $message."\nFrom: ".$fromname."<".$frommail.">"); 
} 
?> 

<html> 
<head> 
<title>Contact Us</title> 
</head> 
<form method="post" action="<? echo($PHP_SELF) ?>"> 
E-mail:<input type="text" name="frommail" size="25"> <br> 

Your Name:<input type="text" name="fromname" size="25"> <br>

Your Message: <br> 

<textarea cols="50" rows="5" name="message">Your Message ..</text> <br> 

<input type="submit" value="Submit"> 

</body> 
</head>
If you need an example to store info into a database I can also do that for you.
 

lennyboy

New Member
Messages
37
Reaction score
0
Points
0
Here's the php script for the page:

<?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')
{
$mailto = 'me@lennyford.x10hosting.com';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Hi, Len!';
$message = 'Values submitted from web site form:';
$success_url = './page5.html';
$error_url = './page6.html';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
$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", "captcha_code");
$message .= $eol;
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 && $_FILES[$key]['size'] <= $max_filesize)
{
$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;
mail($mailto, $subject, $body, $header);
header('Location: '.$success_url);
exit;
}
?>

So, anything stand out that would keep this from working?

TIA!

Len
 

xgreenberetx

New Member
Messages
57
Reaction score
1
Points
0
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header);
header('Location: '.$success_url); <---------------try to remove this just to see if it works.
exit;
 

lennyboy

New Member
Messages
37
Reaction score
0
Points
0
I'm afraid the only change was the success page didn't appear. Thank you, though. Any other thoughts?
 

xgreenberetx

New Member
Messages
57
Reaction score
1
Points
0
$mailto = 'me@lennyford.x10hosting.com';


$mailto = "me@lennyford.x10hosting.com"; <------- try adding double quotes instead of single

You might have to check your email settings and make sure everything looks copacetic.
 

lennyboy

New Member
Messages
37
Reaction score
0
Points
0
$mailto = 'me@lennyford.x10hosting.com';


$mailto = "me@lennyford.x10hosting.com"; <------- try adding double quotes instead of single

You might have to check your email settings and make sure everything looks copacetic.

I'm afraid that didn't work, either. I've been looking at the webmail accounts as well to see if they've hit, and they haven't. Getting curiouser and curiouser!

What else might I try?

Thanks!!!
 

lennyboy

New Member
Messages
37
Reaction score
0
Points
0
One of the developers of WYWISYGWebbuilder asked if X10 supports php email. From what I can see it does, but then again; I'm really no expert on php.

Len
Edit:
Received email from Mr. NavalDesign, but when I went to test it, nothing came through. Could this be a spam setting on the server? Any reason why it would not accept a gmail account?
Edit:
I don't remember, does "/usr/sbin/sendmail" have to be in the php page somewhere? I don't see it on the automatic script from the progam.

Thanks.
Edit:
I got it fixed! Many thanks to all who gave me suggestions. I had tried to use the WYSIWYG editor to alter a pre-existing form from the Form Wizard in WYSIWYGWebbuilder. Something went missing, I guess. I attempted a new form from the Wizard, popped it in the page, uploaded and tried four times with different email address...and it works!

I can now sleep at night! :biggrin:

Len
 
Last edited:
Top