PHP Version 7.2
Forum rules
IMPORTANT NOTE!!
DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.
PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
IMPORTANT NOTE!!
DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.
PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Re: PHP Version 7.2
PHP has always been case sensitive and so it the built-in form script.
Note that I cannot see what the PHP code of the test page is, so I cannot say anything meaningful about why the forms work or not.
What is the PHP code of showvars2.php?
Note that I cannot see what the PHP code of the test page is, so I cannot say anything meaningful about why the forms work or not.
What is the PHP code of showvars2.php?
Re: PHP Version 7.2
Hi Pablo
Here's the HTML code of Showvars2.php:
and the code of the forms page:
Cheers
Here's the HTML code of Showvars2.php:
Code: Select all
<?php
// ini_set("sendmail_from", "info@supake.co.uk");
ini_set("sendmail_from", "xxxxx@yyyyy.zzzzz");
$thevariables = $_POST['thevariables'];
$from = $_POST['from'];
$to = $_POST['to'];
$Subject = "Variable testing";
$EmailBody = "Variable tests - the body - " ."\n\n" ."External Domain Used" ."\n\n" .$thevariables ."\n\n";
$EmailBody .= "FROM FIELD Specified was: " .$from ."\n\n";
$EmailBody .= "TO FIELD Specified was: " .$to;
// $Headers = "From: info@supake.co.uk";
$Headers = "From: " .$from;
mail($to,$Subject,$EmailBody,$Headers);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Page</title>
<link href="PHPMailIssues.css" rel="stylesheet">
<link href="showvars2.css" rel="stylesheet">
</head>
<body>
<div id="wb_Text1" style="position:absolute;left:27px;top:28px;width:900px;height:54px;z-index:0;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Nothing to see here - the email has been sent using PHP and not the built-in form.<br><br>NOTE: '$To' and '$FROM' are variably coded to an email address taken from the form.</span></div>
</body>
</html>
Code: Select all
<?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 = 'info@supake.co.uk';
$mailfrom = 'info@supake.co.uk';
$subject = 'Test Bog Standard';
$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;
$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>bogstandardemail</title>
<link href="PHPMailIssues.css" rel="stylesheet">
<link href="index.css" rel="stylesheet">
<script>
function ValidatebogstandardmailForm()
{
var regexp;
var Editbox1 = document.getElementById('Editbox1');
if (!(Editbox1.disabled || Editbox1.style.display === 'none' || Editbox1.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox1.value.length != 0 && !regexp.test(Editbox1.value))
{
alert("Please enter a valid email address.");
Editbox1.focus();
return false;
}
}
var Editbox2 = document.getElementById('Editbox2');
if (!(Editbox2.disabled || Editbox2.style.display === 'none' || Editbox2.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox2.value.length != 0 && !regexp.test(Editbox2.value))
{
alert("Please enter a valid email address.");
Editbox2.focus();
return false;
}
}
return true;
}
</script>
<script>
function ValidatebogstandardmailForm()
{
var regexp;
var Editbox7 = document.getElementById('Editbox7');
if (!(Editbox7.disabled || Editbox7.style.display === 'none' || Editbox7.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox7.value.length != 0 && !regexp.test(Editbox7.value))
{
alert("Please enter a valid email address.");
Editbox7.focus();
return false;
}
}
var Editbox8 = document.getElementById('Editbox8');
if (!(Editbox8.disabled || Editbox8.style.display === 'none' || Editbox8.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox8.value.length != 0 && !regexp.test(Editbox8.value))
{
alert("Please enter a valid email address.");
Editbox8.focus();
return false;
}
}
return true;
}
</script>
</head>
<body>
<div id="wb_Form1" style="position:absolute;left:51px;top:22px;width:447px;height:193px;z-index:15;">
<form name="bogstandardmailForm" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form1" onsubmit="return ValidatebogstandardmailForm()">
<input type="hidden" name="formid" value="form1">
<input type="text" id="Editbox1" style="position:absolute;left:189px;top:17px;width:216px;height:18px;z-index:0;" name="from" value="" spellcheck="false">
<div id="wb_Text1" style="position:absolute;left:71px;top:22px;width:56px;height:18px;z-index:1;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">From</span></div>
<div id="wb_Text2" style="position:absolute;left:71px;top:61px;width:56px;height:18px;z-index:2;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">To</span></div>
<div id="wb_Text3" style="position:absolute;left:71px;top:95px;width:90px;height:18px;z-index:3;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Message</span></div>
<input type="text" id="Editbox2" style="position:absolute;left:189px;top:56px;width:216px;height:18px;z-index:4;" name="to" value="" spellcheck="false">
<input type="text" id="Editbox3" style="position:absolute;left:189px;top:95px;width:216px;height:18px;z-index:5;" name="message" value="Hello World - Auto Form" spellcheck="false">
<input type="submit" id="Button1" name="Send" value="Submit" style="position:absolute;left:312px;top:139px;width:96px;height:25px;z-index:6;">
</form>
</div>
<div id="wb_Text4" style="position:absolute;left:641px;top:164px;width:124px;height:18px;z-index:16;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">V1.17</span></div>
<div id="wb_Text9" style="position:absolute;left:540px;top:65px;width:249px;height:54px;z-index:17;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Note the <strong>From </strong>and <strong>To </strong>not used here as the Built-in code has that defined</span></div>
<div id="wb_Text11" style="position:absolute;left:548px;top:365px;width:249px;height:72px;z-index:18;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Note the<strong> Built-In form </strong>is <strong>not </strong>used here as the php code is used to process the form data and sends it to showvars2.php</span></div>
<div id="wb_Form3" style="position:absolute;left:51px;top:244px;width:447px;height:312px;z-index:19;">
<form name="bogstandardmailForm" method="post" action="showvars2.php" id="Form3" onsubmit="return ValidatebogstandardmailForm()">
<div id="wb_Text12" style="position:absolute;left:37px;top:40px;width:335px;height:18px;z-index:7;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Variables to send (some text):</span></div>
<input type="submit" id="Button3" name="Send" value="Submit" style="position:absolute;left:319px;top:236px;width:96px;height:25px;z-index:8;">
<input type="text" id="Editbox7" style="position:absolute;left:182px;top:87px;width:216px;height:18px;z-index:9;" name="from" value="" spellcheck="false">
<div id="wb_Text13" style="position:absolute;left:51px;top:141px;width:97px;height:18px;z-index:10;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">To</span></div>
<div id="wb_Text14" style="position:absolute;left:44px;top:87px;width:56px;height:18px;z-index:11;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">From</span></div>
<input type="text" id="Editbox8" style="position:absolute;left:182px;top:136px;width:216px;height:18px;z-index:12;" name="to" value="" spellcheck="false">
<input type="text" id="Editbox9" style="position:absolute;left:182px;top:188px;width:216px;height:18px;z-index:13;" name="thevariables" value="Hello World - PHP Coded" spellcheck="false">
<div id="wb_Text15" style="position:absolute;left:51px;top:193px;width:90px;height:18px;z-index:14;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Message</span></div>
</form>
</div>
</body>
</html>
Last edited by Starb7 on Mon May 20, 2019 5:39 pm, edited 3 times in total.
Re: PHP Version 7.2
p.s. any of the
work. Also, are you able to send to and from a selection of email addresses using the form (to eliminate security issues)? Cheers// ini_set("sendmail_from", "info@supake.co.uk");
Re: PHP Version 7.2
Do you mean that it also works when you remove this?
Note that you can define the 'from' address in the form's properties.
Code: Select all
ini_set("sendmail_from", "clerk@sutton-cum-duckmanton.org.uk");
Re: PHP Version 7.2
I hadn't tried commenting that out so just gave it a go and yes, if you comment it out, it still works as expected. Cheers
Update: I have noticed that I can only send from (to anywhere) Fasthosts based email adders to there is some check going on...
p.p.s. having a lots of problems with the forum page, keeps timing out and very slow to load.
Update: I have noticed that I can only send from (to anywhere) Fasthosts based email adders to there is some check going on...
p.p.s. having a lots of problems with the forum page, keeps timing out and very slow to load.
Re: PHP Version 7.2
Do you get the same error if you use another email address?Update: I have noticed that I can only send from (to anywhere) Fasthosts based email adders to there is some check going on...
Re: PHP Version 7.2
Yes, I get
Cheers
Line 18 being: mail($to,$Subject,$EmailBody,$Headers);PHPWarning: mail(): SMTP server response: 554 5.7.1 <info@supake.co.uk>: Recipient address rejected: Access denied in \\HP3-WINC2-SMB2.HOSTINGP3.LOCAL\DOMAINSZ\952\1944952\user\htdocs\bogstandardmail\showvars2.php on line 18
Cheers
Re: PHP Version 7.2
So, this confirm that it's a server issue?
As mentioned you can set the 'from' address in the form's properties.
As mentioned you can set the 'from' address in the form's properties.
Re: PHP Version 7.2
No, not really. I knew that you could do that (and did try that) in the Built-in forms but it doesn't work. I have just edited and added it back in to verify and it still fails. Cheers
Re: PHP Version 7.2
Well here's an oddity, if you go into the settings and choose 'Mail Engine' and select 'mail' the built-in form works as expected, why would that be? Cheers
EDIT: its gets better - it appears I can actually 'send from' any email address, even fictitious email addresses, eg foo@bar.com will send email. Give it a go, the bottom form... does it work for you?
EDIT: its gets better - it appears I can actually 'send from' any email address, even fictitious email addresses, eg foo@bar.com will send email. Give it a go, the bottom form... does it work for you?
Re: PHP Version 7.2
Yes, it does!No, not really.
The script does not care which email address you use, so somewhere on the server sode there is a filter that checks which email address issue as 'from'.
[quotwhy would that be?[/quote]
Because it uses php mailer instead of standard PHP mail. This works different and may bypass some server specific configuration.
Re: PHP Version 7.2
Sorry, when you put
, with a ? mark, I thought you were asking me. In any case, as I can either use 'hand coded' or 'PHP Mailer' for built-in forms, it's a win-win for me. Many thanks for your help and patience and as always, a top service. Thanks.So, this confirm that it's a server issue?