AutoEmailer
#161
Posted 12 July 2008, 17:22
For the greeting, try placing it before $message = '.
Jack
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#162
Posted 07 August 2008, 22:14
culturebee, on Nov 2 2005, 04:59 AM, said:
Warning: main(../../admin/FCKeditor/fckeditor.php): failed to open stream: No such file or directory in /home/xxxxxxxxxx/public_html/admin/includes/functions/html_output.php on line 12
Warning: main(../../admin/FCKeditor/fckeditor.php): failed to open stream: No such file or directory in /home/xxxxxxxxx/public_html/admin/includes/functions/html_output.php on line 12
Fatal error: main(): Failed opening required '../../admin/FCKeditor/fckeditor.php' (include_path='.:/usr/local/lib/php') in /home/xxxxxxxxxx/public_html/admin/includes/functions/html_output.php on line 12
in my html_output i have this 'home/xxxxxxxxx/public_html/admin/FCKeditor/');
thank you
try this one:
require(DIR_FS_ADMIN . '/fckeditor/fckeditor.php');
fckeditor not FCKeditor ^^
#163
Posted 21 October 2008, 17:13
my auto emailer was working fine until recently, however it cannot connect to the database for some reason now.
I was trying to call auto_emailer/auto_emailer.php from admin with this path ../includes/configure.php and it is working fine, however it fails when executed via cron. I was also trying to use include(DIR_FS_ADMIN . 'includes/configure.php'); but id did not work either. It keeps throwing the error.
Any ideas what might be wrong?
#164
Posted 21 October 2008, 17:20
Jack
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#165
Posted 21 October 2008, 17:43
#166
Posted 22 November 2008, 12:24
Jack_mcs, on Oct 21 2008, 06:20 PM, said:
Jack
we are still unable to make it work, perhaps you can help. To see and test if it is working, I've created a test file that was placed in admin root:
<?php
ini_set('display_errors','1');
/*
$Id$
AutoEmailer by Jack_mcs at www.oscommerce-solution.com
Released under the GNU General Public License
*/
include('auto_emailer/class.Email.php');
include('includes/configure.php');
// option 2 $dbh used instead of $ link
$dbh=mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db(DB_DATABASE);
//Set some common items
$Sender = 'test@site.com';
$Recipiant = 'test@site.com';
$Cc = '';
$Bcc = '';
$currentDate = date('Y-m-d'); //or enter a date in the form of yyyy-mm-dd
include('auto_emailer/date_functions.php');
// Start modules
include('auto_emailer/auto_announce_test.php');
// Stop modules
echo 'The birthday seems to work now - this is test only!'."\r\n";
mysql_close($link);
?>
The above file is in admin root and works fine when executed via cron job. However when I place the file in admin/auto_emailer/ folder and execute it via cron, it doesn't work, with the following error: Cannot connect to the database because: Unknown MySQL server host 'DB_SERVER' (1)The file is almost identical, changed paths obviously, it works when executed from the admin site of the store:
<?php
ini_set('display_errors','1');
/*
$Id$
AutoEmailer by Jack_mcs at www.oscommerce-solution.com
Released under the GNU General Public License
*/
include('class.Email.php');
include('../includes/configure.php');
// option 2 $dbh used instead of $ link
$dbh=mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db(DB_DATABASE);
//Set some common items
$Sender = 'test@site.com';
$Recipiant = 'test@site.com';
$Cc = '';
$Bcc = '';
$currentDate = date('Y-m-d'); //or enter a date in the form of yyyy-mm-dd
include('date_functions.php');
// Start modules
include('auto_announce_test.php');
// Stop modules
echo 'The birthday seems to work now - this is test only!'."\r\n";
mysql_close($link);
?>
#167
Posted 22 November 2008, 12:37
Jack
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#168
Posted 22 November 2008, 13:28
#169
Posted 22 November 2008, 15:17
Jack
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#170
Posted 04 December 2008, 17:58
$customer
Not
$customers
#171
Posted 04 December 2008, 18:14
I was trying to get this contrib working and was pulling my hair out when i notices that the line
$Recipiant = $customers['customers_email_address'];
was suppose to be
$Recipiant = $customer['customers_email_address'];
That got it to work but I found out that all my customers were getting my customer report. I would watch out for that people. I only noticed because I had a test account in Oscommerce. anyone have a fix for that. Also I don't see my orders report coming out anywhere.
#172
Posted 09 September 2009, 19:49
this is probably php5 related: I'm receiving this warning after the cron job is executed:
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/xxxxxxx/public_html/admin/auto_emailer.php on line 32
Can it be changed to get rid of that warning please?
#173
Posted 09 September 2009, 23:44
mr_absinthe, on Sep 9 2009, 03:49 PM, said:
this is probably php5 related: I'm receiving this warning after the cron job is executed:
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/xxxxxxx/public_html/admin/auto_emailer.php on line 32
Can it be changed to get rid of that warning please?
mysql_select_db(DB_DATABASE);to
mysql_select_db(DB_DATABASE, $link);If it still fails try changing this line
mysql_close($link);to
mysql_close();
Jack
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#174
Posted 10 September 2009, 10:34
thank you for your quick reply, this is the solution that is working now:
I changed this:
Quote
mysql_select_db(DB_DATABASE, $link);
Quote
mysql_select_db(DB_DATABASE);
Quote
#175
Posted 15 October 2009, 17:30
Whilst testing admin/auto_emailer/auto_announce.php, it appeared that the entire list of customers are returned on the initial $customers_query, then the results are searched for upcoming birthdays, (at least it was in my case)
then it occurred to moi that it might be useful for the storeowner to have advance notice of who(m) was having a birthday like the day before, so combining these 2 items, the auto_announce.php was copied and renamed auto_reminder_birthday.php and modified to send the store owner an email the day before and the initial query was changed to only bring back customers whose birthday matched the month-day search string, in the spirit of osCOM(merce)RADERIE, here is what I did-
oh, just in case - this worked for my version of oscommerce (osCommerce Online Merchant v2.2 RC2a)
1. make a copy of admin/auto_emailer/auto_announce.php
2. rename the copy - auto_reminder_birthday.php
3. replace code in NEW auto_reminder_birthday.php
LOOK FOR:
$customers_query = mysql_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, ci.customers_info_date_account_created, ci.customers_info_id from customers c, customers_info ci where c.customers_id = ci.customers_info_id") or die(mysql_error());
$adjYr = substr($currentDate, 0, 4);
$adjMth = (int)substr($currentDate, 5, 2);
$adjMth = str_pad($adjMth, 2, "0", STR_PAD_LEFT);
while ($customer = mysql_fetch_array($customers_query, MYSQL_ASSOC))
{
// Start Date Selection
$adjDate = sprintf("%s-%s-%s", $adjYr, substr($customer['customers_dob'], 5, 2),substr($customer['customers_dob'], 8, 2));
// Stop Date Selection
$diff = DifferenceBetween($currentDate, $adjDate);
// Start Date Difference
if ($diff >= 0 && $diff < 77)
// Stop Date Difference
{
// Start Subject
$Subject = 'test' . ' ' . $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
// Stop Subject
$Recipiant = $customer['customers_email_address'];
REPLACE WITH: (ordinarily I'd suggest commenting it out but since this is a copy, I simply replaced it)
// 10-15-09 mod to send advance notice to store owner of upcoming birthday
$result = mysql_query("SELECT configuration_value FROM configuration WHERE configuration_key = 'STORE_OWNER_EMAIL_ADDRESS'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
$store_owner_email_address = $row[0];
echo $row[0]; // the email value
$adjYr = substr($currentDate, 0, 4);
$adjMth = (int)substr($currentDate, 5, 2);
$adjMth = str_pad($adjMth, 2, "0", STR_PAD_LEFT);
$adjDay = (int)substr($currentDate, 8, 2);
// increment day to show birthdays for tomorrow can be changed to give more advance notice eg 7 for a weeks notice
$adjDay = $adjDay +1 ;
// echo 'adjDay = ' . $adjDay . '<br />';
$searchdate = $adjMth . '-' . $adjDay;
// echo 'searchdate = ' . $searchdate . '<br />';
// search customers_dob by month and day using LIKE for any occurences
$searchdate = '%' . $searchdate . '%';
// THIS PART IS NOTES OF CHANGES- can be deleted
// 10-15-09 original before search for specific date rather than retrieve whole table $customers_query = mysql_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, ci.customers_info_date_account_created, ci.customers_info_id, c.customers_sponsor_email from customers c, customers_info ci where c.customers_id = ci.customers_info_id") or die(mysql_error());
// substring didn't work for moi $customers_query = mysql_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, ci.customers_info_date_account_created, ci.customers_info_id, c.customers_sponsor_email from customers c, customers_info ci where c.customers_id = ci.customers_info_id AND substring(c.customers_dob,5,5) LIKE '$searchdate'") or die(mysql_error());
// X THIS PART IS NOTES OF CHANGES- can be deleted
$customers_query = mysql_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, ci.customers_info_date_account_created, ci.customers_info_id, c.customers_sponsor_email from customers c, customers_info ci where c.customers_id = ci.customers_info_id AND c.customers_dob LIKE '$searchdate'") or die(mysql_error());
while ($customer = mysql_fetch_array($customers_query, MYSQL_ASSOC))
{
$cusdob = substr($customer['customers_dob'],5,5);
// to test
echo "customer = " . $customer['customers_lastname'] . ' cusdob = ' . $cusdob;
// Start Date Selection
$adjDate = sprintf("%s-%s-%s", $adjYr, substr($customer['customers_dob'], 5, 2),substr($customer['customers_dob'], 8, 2));
// Stop Date Selection
$diff = DifferenceBetween($currentDate, $adjDate);
// Start Date Difference
if ($diff >= 0 && $diff < 77)
// Stop Date Difference
{
// Start Subject
$cfirst_name = $customer['customers_firstname'];
$clast_name = $customer['customers_lastname'];
$cdob = $customer['customers_dob'];
// echo 'current date = ' . $currentDate;
/*** another date ***/
$tdate = $currentDate;
//$bday = date("m/d");
$currentmonth = date('M',strtotime($currentDate));
$year = date('Y',strtotime($currentDate));
$byear = date('Y',strtotime($cdob));
$month = date('M',strtotime($cdob));
$day = date('d',strtotime($cdob));
// UNTESTED conditional to increment year if current date is in December and birthday is in January
if ($currentmonth == "Dec" && $month == "Jan") {
$year = $year + 1;
}
$birthday = $year . '-' . $month . '-' . $day;
$weekday = date('l', strtotime($birthday)); // note: first arg to date() is lower-case L
$bday = $weekday . ', ' . $month . ' ' . $day;
//echo 'bday = ' . $bday;
/*** show the date ***/
$age = $year - $byear;
$Subject = 'Reminder - ' . $cfirst_name . ' ' . $clast_name . ' will celebrate their ' . $age . 'th Birthday on ' . $bday . '.';
// orig $Subject = 'test' . ' ' . $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
// Stop Subject
// this is a new field in customers to use another email to be notified with instead of store owners email $Recipiant = $customer['customers_sponsor_email'];
$Recipiant = $store_owner_email_address;
// X 10-15-09 mod to send advance notice to store owner of upcoming birthday
4. in admin/auto_emailer.php
LOOK FOR:
// Start modules
ADD UNDERNEATH
// 10-15-09 mod to send advance notice to store owner of upcoming birthday
include('auto_reminder_birthday.php');
// X 10-15-09 mod to send advance notice to store owner of upcoming birthday
5. Save these files, upload
6. TEST by calling in browser: changing URL to match your website and admin folder name
http(s)://CHANGE_TO YOUR_WEBSITE.COM!/YOUR_ADMIN_FOLDER(hopefully not called admin for security purposes)/auto_emailer/auto_emailer.php
You should get an echo of results and an email sent to the store owner email address.
I also added a field to customers table called customers_sponsor_email which can be used to designate a different email address if such a situation arose...
There are a few echo statement to show results which can then be commented out or deleted
The conditional IF to increment the year for December/January is untested because, well you know, right?
Hope I touched all the bases,
jk
#176
Posted 15 October 2009, 18:12
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#177
Posted 23 October 2009, 08:38
I'm still experiencing the same issue as last year, but it is getting worse.
One of our customers reported the issue and forwarded our message - "the From field in this email I received from you. Almost 2500 repeats of the from address "info@ourstore.com."
I've not been counting those From fields, but there were a lots!
Any idea what might be causing it please? I need to be pointed some direction where to look at.
It cannot be related to php (now on 5, before on 4) nor sql (now on 5).
#178
Posted 23 October 2009, 13:40
mr_absinthe, on 23 October 2009, 08:38, said:
One of our customers reported the issue and forwarded our message - "the From field in this email I received from you. Almost 2500 repeats of the from address "info@ourstore.com."
I've not been counting those From fields, but there were a lots!
Any idea what might be causing it please? I need to be pointed some direction where to look at.
It cannot be related to php (now on 5, before on 4) nor sql (now on 5).
Edited by Jack_mcs, 23 October 2009, 13:41.
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking
#179
Posted 24 October 2009, 19:51
The customer received one email only, but the "From" field contained some 2500 our email addresses (or the "From: field was repeated 2500 times) . It looked like this:
From: info@mystore.com
From: info@mystore.com
From: info@mystore.com
From: info@mystore.com
From: info@mystore.com
From: info@mystore.com
From: info@mystore.com
From: info@mystore.com
etc, etc
I've contacted my host and they confirmed that the problem's source is going to lie in the PHP code.
#180
Posted 25 October 2009, 00:38
- fetch an entry from the database querry
- if the date falls within range, send the email
- start over
If multiple emails are being sent, it seems like it would have to be multiple entries in the database that match the date range and has that customers email address. It could also be that the date comparison code is failing. Are your dates enterered in UL format by chance? That would break the code since it assumes mm/dd/yyyy not dd/mm/yyyy. Other than that, it would be a difficult problem to isolate unless you can make it fail at will.
Most Important: Header Tags SEO - Ultimate SEO V 2.2d
All SEO Addons: Recommended SEO Addons
Support Links:
Finding relevant link exchanges - Headers Already Sent - What does it cost? -What's my version? - How to change titles? - Preventing HotLinking














