close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Add CMS area to email script?

Thread began 1/05/2017 9:09 am by Mags | Last modified 3/30/2021 2:05 pm by Ray Borduin | 2328 views | 13 replies |

Mags

Add CMS area to email script?

I have an automated email response set up on a web form on a site using PowerCMS. I'd like to allow CMS users to update the text when the office is closed, but not sure of the correct syntax to include a CMS area in the email script file - something like this but it contains a syntax error:

$MailBody = $MailBody . "</style><head></head><body> "echo WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'Email Text', 'Text')"\r\n";

Can you help?

Sign in to reply to this post

Ray BorduinWebAssist

$MailBody = $MailBody . "</style><head></head><body> " . WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'Email Text', 'Text') . "\r\n";

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

Mags

Fantastic service as always, many thanks Ray!

Sign in to reply to this post

Mags

Hi Ray, following on from the thread above, I recently updated the site to use the new PowerCMS with mySQLi behaviors. I would still like to include a CMS area in the email - how would I update the code so that it works correctly?

$MailBody = $MailBody . "</style><head></head><body> " . WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'Email Text', 'Text') . "\r\n";

Sign in to reply to this post

Ray BorduinWebAssist

I think it is the same. If you get an error or it doesn't work I might need FTP access to debug it.

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

Mags

Hi Ray

Looking at this again, I can see that because Universal Email has updated the way it works too, this is now set up differently. Previously I included the above line in the email script but now the body of the email is contained in a separate file, so the script looks like this:

$Email->BodyFile = "webassist/email/email-confirmation.php";

However if I try to include a PowerCMS area in the email-confirmation.php file it throws up errors. I tried including the full line from the developer notes:

<?php echo(require_once("/var/www/vhosts/mydomain.co.uk/httpdocs/WA_CMS/WA_CMS.php")); ?>
<?php echo(WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'Shared Email Text', 'Text', false)); ?>

Also tried including the full path to the db connection file: <?php require_once('/var/www/vhosts/mydomain.co.uk/httpdocs/Connections/PowerCMSConnection_i.php'); ?>

Example of errors below:

Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/phpmailer/src/PHPMailer.php on line 3632

Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/phpmailer/src/PHPMailer.php on line 3632

Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/phpmailer/src/PHPMailer.php on line 3632

Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/phpmailer/src/PHPMailer.php on line 3632

Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/phpmailer/src/PHPMailer.php on line 3632

Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/phpmailer/src/PHPMailer.php on line 3632

Notice: Undefined variable: PowerCMSConnection in /var/www/vhosts/mydomain.co.uk/httpdocs/WA_Globals/WA_Globals.php on line 42

Fatal error: Uncaught Error: Call to a member function query() on null in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/mysqli/rsobj.php:213 Stack trace: #0 /var/www/vhosts/mydomain.co.uk/httpdocs/WA_Globals/WA_Globals.php(44): WA_MySQLi_RS->execute() #1 /var/www/vhosts/mydomain.co.uk/httpdocs/WA_CMS/WA_CMS.php(5): require_once('/var/www/vhosts...') #2 /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/email-confirmation.php(7): require_once('/var/www/vhosts...') #3 /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/WA_Email.php(315): require('/var/www/vhosts...') #4 /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/email/WA_Email.php(476): WA_Email->getFromPage('webassist/email...') #5 /var/www/vhosts/mydomain.co.uk/httpdocs/shared/email-script.php(97): WA_Email->send(0) #6 /var/www/vhosts/mydomain.co.uk/httpdocs/counselling.php(11): include('/var/www/vhosts...') #7 {main} thrown in /var/www/vhosts/mydomain.co.uk/httpdocs/webassist/mysqli/rsobj.php on line 213

I've attached the current email script and also the email content file. I've had to put everything back the way it was on the site because it's a live site, but let me know if you still need access, or I'm hoping there might be something obvious in the above or the attached files that I've missed!

Sign in to reply to this post

Ray BorduinWebAssist

Change the require_once() references in the email body to just require().

Then you may need to update DataBridge to get the latest version of the include files to get rid of the Deprecated messages. You could also just add this to the top of the page for now:

php:
<?php

error_reporting
(E_ALL E_DEPRECATED);
?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Mags

Changing it to require() worked, although for some reason it's adding a "1" to the start of the email so it looks like this:

1
Thank you for submitting a query via our website...

I've checked both the PHP file and the CMS contents and there's no "1" in it - any idea what might be causing that?

Sign in to reply to this post

Ray BorduinWebAssist

Is that text from the CMS? Can I get FTP access and a url to debug? It could be a bug in the cms code.

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

Mags

Yes, it's from the CMS - have checked there and also in the email-confirmation.php file. FTP details in PM section.

Sign in to reply to this post
loading

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...