close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

error WA_Email.php on line 6

Thread began 8/25/2018 8:21 am by Darren | Last modified 9/20/2018 7:35 pm by Ray Borduin | 2401 views | 5 replies |

Darren

error WA_Email.php on line 6

testing the email on a contact page and getting the following error

Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in ..\webassist\email\WA_Email.php on line 6

created a blank PHP and getting the same ?


test.php
===================================================================================
<?php require_once("../webassist/email/WA_Email.php"); ?>
<?php
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) { //WA Universal Email
$Email = new WA_Email("test1");
$Email->Redirect = "../index.htm";
$Email->From = "website@mydomain.co.uk";
$Email->addTo("test@mydomain.co.uk");
$Email->BodyFile = "../webassist/email/templates/WebAssist-Block/Block.php";
if (function_exists("rel2abs") && $Email->Redirect) $Email->Redirect = $Email->Redirect?rel2abs($Email->Redirect,dirname(__FILE__)):"";
for ($emailGroup=0; $emailGroup<sizeof($Email->To); $emailGroup++) {
$Email->Subject = "test-email";
$Email->send($emailGroup);
}
$Email->close();
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post" name="test" lang="en">
<input name="testfield" type="text" value="testfield" size="50">
<input name="submit" type="button">
</form>
</body>
</html>


WA-Email.php
===================================================================================
ln6 use PHPMailer\PHPMailer\PHPMailer;
ln7 use PHPMailer\PHPMailer\Exception;


directory structure - not sure if the above are directory links or if these are linked to a remote site ?:
webassist\email\phpmailer\src\PHPMailer.php
webassist\email\phpmailer\src\Exception.php

Sign in to reply to this post

Ray BorduinWebAssist

What version of php are you using? I think you may need PHP 5.3 or later to use namespaces, which is what that line does. Can you update to a newer PHP version easily?

Sign in to reply to this post
Did this help? Tips are appreciated...

Darren

thanks, I am using old version locally but on the hosting service I thought I was using PHP7. checking the settings it was in compatible mode, changed this to PHP7 and now working... very strange as since the hosting service upgrade to PHP7 the website stopped working...

now getting a lot of other errors on other pages but that's for another thread

thank you

Sign in to reply to this post

Darren

quotes from other threads

Originally Said By: dhagood355349
  What versions of DW will the new DataBridge work with?  



Originally Said By: Ray Borduin
  CS6 and Later.  



that may explain why the email side is not working, I am running CS5.x and all seems OK, I can setup database connections and the email using databridge(beta) but no emails are being sent either running local PHP7 or on the hosting service. I recreated the page from scratch with no validation and still not working

I am looking out for CS6 suite to buy however do you have a EoL service for CS6. I can not justify the ongoing cost of CC

Sign in to reply to this post

Ray BorduinWebAssist

The email should still work in CS3 and above. Just the advanced querybuilder, and database modeling wouldn't work. The issue with the email isn't related to your Dreamweaver version.

If you post FTP information and a url where I can test I will debug your email page and let you know what the issue is.

Email won't work on your localhost since local servers won't have a functioning SMTP server to send emails. You would have to be using a hosted server for testing email.

Sign in to reply to this post
Did this help? Tips are appreciated...

Darren

sorry for delay - been waiting for CS6 to arrive as I want to use the other functions...

I found the issue: I changed the following

if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) { //WA Universal Email


TO:
if (isset($_POST["subby"]) || isset($_POST["subby_x"])) { //WA Universal Email

and also found I had set the email to use my ISP SMTP gateway, changed this to 'mail' and now all working - thanks again

next step to restore the email page to read from the form as this didn't auto update and recreate the validation

the validation new functions / features for the form looks great :)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...