close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Questions re scheduled emails

Thread began 1/22/2015 4:40 am by Mags | Last modified 1/22/2015 12:10 pm by Jason Byrnes | 1422 views | 5 replies |

Mags

Questions re scheduled emails

I've set up an email form with a trigger of 'before page load' and have also set up a Cron job on our server to run the page once a day in order to send emails to selected records in the database. It all works fine, but I'm getting an error message and I also have a question about security.

Q1: I'm getting a system-generated email when the script runs which says:

PHP Notice: Undefined variable: mailContent in
/var/www/vhosts/(mydomainname)/httpdocs/webassist/email/mail_php.php on line 111 PHP Warning: date(): It is
not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the
date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you
most likely misspelled the timezone identifier. We selected 'UTC' for 'GMT/0.0/no DST' instead in
/var/www/vhosts/(mydomainname)/httpdocs/webassist/email/mail_php.php on line 189 ?>

Line 111 of that file is: $htmlEmail = $mailBody;$_SESSION[$mailRef."_Body"] = $mailContent;

Line 189 of that file is: $mailHeader .= "Date: ". date('r (T)').$lineEnd;

What changes can I make to the mail_php.php file to stop this error?

Q2: I originally had the email page protected by SecurityAssist - however it seems the server can't access it because of this. It only works if I remove the protection. Wouldn't this be a security issue though as anyone could access and run the script?

Sign in to reply to this post

Jason ByrnesWebAssist

This is a php server issue.

The host should be able to update the php.ini file for you to set the default timezone to prevent that error from occurring. It happens if the default time zone is not set in the php.ini.


alternately you can add the following code to your page to set the time zone:
<?php
date_default_timezone_set('Europe/London');
?>

The list of valid timezones is here...

http://www.php.net/manual/en/timezones.php

As for question 2, there really isn't a way for the Server to 'log in' to security assist in the sense of creating a user Session. what you could do is set the cornjob to pass a query string, make it something complex like:

emailpage.php?mMAoM01LT3305Qha=23dygPQrNseL7cPO

and set up an access rule as
Allow IF:
URL Variable mMAoM01LT3305Qha
=
23dygPQrNseL7cPO

and apply that access url to the page rather than one that uses a session

the chances of a random user guessing a URL variable like:
mMAoM01LT3305Qha=23dygPQrNseL7cPO

are pretty slim at best

Sign in to reply to this post

Mags

Thanks Jason, I've managed to get around the security issue by putting the file in a secured folder using .htaccess. The date error has now disappeared although I'm getting a few others but to be honest, I can live with it as long as the emails are being sent!

I do have another question though, regarding using dynamic data in the body of the email. I have the email trigger set to "before page load" since it's the cron job that's actually activating the emails, so there's no web form on the actual page. I have a recordset and the emails are being sent correctly to all recipients in the recordset. I have the subject line set to <?php echo $RecipArray[$RecipIndex][0]["ClientName"]; ?> and that shows the correct Client Name in the Subject line. However, I also want to include the Client Name in the body of the email but the body is controlled by a bespoke page, waue_emailtest_1.php. This page uses the same recordset and I've put the following at line 1:

<?php
global $RecipArray;
global $RecipIndex;
?>

I'm using the following to get the Client Name: <?php echo ($RecipArray[$RecipIndex][0]["[ClientName]"])?> but it doesn't work. I'm guessing I've missed something that ties the Universal Email behavior page and the template page together?

Sign in to reply to this post

Jason ByrnesWebAssist

looks like you have extra square brackets.

["[ClientName]"]

should be:
["ClientName"]

Sign in to reply to this post

Mags

That did it, thanks, working now!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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