npn2531 Posted June 28, 2013 Author Share Posted June 28, 2013 (edited) Yes, it does, it will refresh 1700 times. What it is doing is running a simple database query, without a loop. Thus it will pull one record only when the script runs after the page refreshes. You could set up the database query to run as a loop with a limit on the number of records it pulls. Then it would indeed email them as chunks, and then refresh, and you could still moderate the emailing. But what difference does it make if the page refreshes 1700 times or 170 times? It's not like it's important to have pinpoint accuracy in setting the speed. If you set it to say 8 and it runs somewhere between 400-450 emails an hour, that's close enough, at least for me. Edited June 28, 2013 by npn2531 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gtilflm Posted June 28, 2013 Share Posted June 28, 2013 Last question (hopefully). After a sending, is there a record of the number of emails it was sent to? And maybe even a list of email addresses that did receive it? That would be a great way to ensure everything is working properly and that email per hr. server limits weren't reached. Quote Link to comment Share on other sites More sharing options...
npn2531 Posted June 28, 2013 Author Share Posted June 28, 2013 The Mail Manager does give you a running count of what is going on while it is running, but a report file is a good idea. In my earlier manifestation of Mail Manager, the Bulk Mail Manager, http://addons.oscommerce.com/info/6553 , there is a report file. You could, with a basic knowledge of php paste the necessary snippets into Mail Manager to get a report file. In the Bulk Mail Manager, in epis_bulkmailer.php, you will find this snippet which creates a file, "epismaildata.php";, for the report: //create the report file and stamp it with heading, date/time, and newsletter title $stringData1 = "epismaildata.php"; $stringData2 = "<br/>"."$nInfo->title"."<br/><br/>"; $date = date("D, d M Y g:i a").'<br/>'; $myFile = "epismaildata.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "$stringData1 $date $stringData2 "; fwrite($fh, $stringData); fclose($fh); Lower down the same page you will find the code that sends the email, displays it, and then appends the name of email to this file // send mail to the next person with a 0 status within newsletter subscribers echo tep_mail($firstname,$email,$nInfo->title,$newsletter_content,$epis_newsletter, STORE_OWNER,STORE_OWNER_EMAIL_ADDRESS); // display email just emailed echo $email; // append this email to epismaildata.php $myFile = "epismaildata.php"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "$email"."<br/>"; fwrite($fh, $stringData); fclose($fh); To adapt to the Mail Manager place the first snippet near the top of admin/includes/mm_bulkmail.php. Place the second snippet (after //apend this emal to epismaildata.php) after this lower down the page: //start mailing loop if($mail['mmstatus']=='0'){ tep_mm_sendmail($mail['customers_firstname'].' '.$mail['customers_lastname'], $mail['customers_email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $newsletter['subject'], $output_content_html, $output_content_txt); $email=$mail['customers_email_address']; This is not tested, and will need some correction and polishing, but if you can get a report file installed in Mail Manager, please add it to the contribution here: http://addons.oscommerce.com/info/8120 as an update. Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gtilflm Posted June 30, 2013 Share Posted June 30, 2013 Two things. 1.) I just finished my first mass sending and there were multiple issues with the 1,700 times of refreshing the page. It was a variety of things and I feel that I may need to alter how this script works to use cron instead. I'll have to think about it. Jase, I can get you my code if I end up doing that. 2.) Jase, I did code in the reporting and it was HUGE in dealing with the issues I encountered. Do you want me to update the package with it? Post it here? Hold off until the cron method is implemented? Let me know. Thanks for the contrib., BTW. Quote Link to comment Share on other sites More sharing options...
npn2531 Posted June 30, 2013 Author Share Posted June 30, 2013 Go ahead and post an update. The contribution is open to anyone. I'm looking forward to seeing it. I am not keen on using cron. That involves going outside the OSCommerce program and some set up and configuration on your control panel with your webhost. I wrote the program to be simple and straightforward, to run entirely within the OSCommerce shop. In fact it was my frustration with cron and the issues of maintaining a separate list in phpList or a commercial account like Mail Chimp that motivated me to write mailmanager. What kind of issues do you have with refreshing? I kinda of see it as a plus. Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gtilflm Posted June 30, 2013 Share Posted June 30, 2013 There were a handful of issues and some were related to how I modified the contrib. to work in the way I wanted it to. So, I don't fully remember all of the issues that were on my end vs. inherent issues with refreshing. A couple that come to mind though are... One time I got some kind of couldn't connect to server error due to too many database connections. One time I got a connection reset error from Firefox. As for the report add-on, it's below. It will place an html file in the admin dir. and email the store owner that the report is there with a link to it. I'll update the contrib. if you think it's solid enough. Note that I've modified things a bit, so some variables might work for me, but still may not fit with the contrib. at large. Both edits are in /catalog/admins/mm_bulkmail.php 1.) BEFORE: echo "<meta http-equiv='refresh' content=$mailrate>"; ADD: //Create/update log file of sent emails. $log_file_id = tep_session_id (); //Using tep_session_id to make the file name unique to this mailing. It's unlikely that someone would send the same newsletter while still logged in with the same session_id. $email_name = $mail['first_name'] . ' ' . $mail['last_name']; $date_time = date("D, d M Y g:i a"); //Does the log file already exist? $log_file_check = tep_db_input($newsletter_id) . '_' . $log_file_id . '.html'; if (!file_exists($log_file_check)) { $log_data = ' <table> <tr> <td colspan="3"><h1>Log File of Sent Emails for Newsletter ID #' . tep_db_input($newsletter_id) . '</h1></td> </tr> <tr> <td colspan="3"><h3>Sending began on ' . $date_time . ' (server time)</h3></td> </tr> <tr> <td><h3>Name</h3></td> <td><h3>Email</h3></td> <td><h3>Date/Time</h3></td> </tr> <tr> <td>' . $email_name . '</td> <td>' . $email . '</td> <td>' . $date_time . '</td> </tr> '; } else { $log_data = ' <tr> <td>' . $email_name . '</td> <td>' . $email . '</td> <td>' . $date_time . '</td> </tr> '; } $log_file_id = tep_session_id (); $log_file = fopen(tep_db_input($newsletter_id) . '_' . $log_file_id . '.html', 'a+'); fwrite($log_file, $log_data); fclose($log_file); 2.) BEFORE: ?> <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '10', '20'); ?></td></tr> <tr><td class="main"><font color="#ff0000"><b> <?php echo TEXT_FINISHED_SENDING_EMAILS; ADD: //Finish updating log file of sent emails. $date_time = date("D, d M Y g:i a"); $log_data = '</table><br><br> END OF LOG DATA FOR THIS BULK EMAIL SEND.<br><i>Ended sending on ' . $date_time . ' (server time)</i>'; $log_file_id = tep_session_id (); $log_file = fopen(tep_db_input($newsletter_id) . '_' . $log_file_id . '.html', 'a+'); fwrite($log_file, $log_data); fclose($log_file); //Email the store admin about the mailing being complete $log_file_location = tep_db_input($newsletter_id) . '_' . $log_file_id . '.html'; $log_email_subject = 'Bulkmail sending of ' . $newsletter['title'] . ' complete'; $log_email_body = 'The bulkmail sending of ' . $newsletter['title'] . ' complete. You can view the log file containing information on who was emailed and more information <a href="' . HTTP_CATALOG_SERVER . DIR_WS_ADMIN . $log_file_location . '">here</a>.'; tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $log_email_subject, $log_email_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); That's it! Quote Link to comment Share on other sites More sharing options...
npn2531 Posted June 30, 2013 Author Share Posted June 30, 2013 (edited) Works great! I had no issues with any variables, and I ran it just as you posted it. That is a nice touch adding the report notification email. By all means go ahead and post the update to the contribution. I did make one minor addition. It simply repeats one line of your code so that the report link is echoed when the mailing is finished. Add the following to the end of your step 2 above: echo 'You can view the log file containing information on who was emailed and more information <a href="' . HTTP_CATALOG_SERVER . DIR_WS_ADMIN . $log_file_location . '">here</a>.'; Edited June 30, 2013 by npn2531 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gtilflm Posted June 30, 2013 Share Posted June 30, 2013 Ok. I've posted the new full package in the addon area. I still may end up using cron at some point, but I'll give this way another shot. I already modified things to use a different database table called "subscriptions", so I have no problem going outside the bounds of OsCommerce. Anyway, thanks for the support. Quote Link to comment Share on other sites More sharing options...
Fyod Posted July 1, 2013 Share Posted July 1, 2013 (edited) Great addon guys! Just one tiny flaw. When I preview some of the templates (Choice, Cssosc, Bluebox) , they throw off my admin side code (I have a heavily customized admin), mainly the page width (mine's set to 1250px) and/or body background. I'm too tired to go through the code, but it's probably just a small mistake somewhere, or the mail template code is overriding something. I'll see if I can find it tomorrow. Cheers! Edited July 1, 2013 by Fyod Quote Link to comment Share on other sites More sharing options...
vaggolena Posted July 2, 2013 Share Posted July 2, 2013 Jase, I have to say great contrib and also to thank you for all the support you have provided for this. I do have a question though, is there an option to have a copy of an email sent go to the admin as well? Quote Link to comment Share on other sites More sharing options...
npn2531 Posted July 2, 2013 Author Share Posted July 2, 2013 (edited) When I preview some of the templates (Choice, Cssosc, Bluebox) , they throw off my admin side code (I have a heavily customized admin), mainly the page width (mine's set to 1250px) and/or body background. I'm too tired to go through the code, but it's probably just a small mistake somewhere, or the mail template code is overriding something. If you find a fix for this I'd love to see it. The preview does the same thing to my admin. I suspect it is because the email templates use inline styling, and are basically made to be stand alone html documents that will display in the recipients email box, and have no connection to the admin's CSS styling or programing. Edited July 2, 2013 by npn2531 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
npn2531 Posted July 2, 2013 Author Share Posted July 2, 2013 I have to say great contrib and also to thank you for all the support you have provided for this. I do have a question though, is there an option to have a copy of an email sent go to the admin as well? No, not as written. But there is a 'test' button that will send the email to the admin. Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
vaggolena Posted July 2, 2013 Share Posted July 2, 2013 No, not as written. But there is a 'test' button that will send the email to the admin. Thanks for the quick response. The reason I am asking is because the site is a restaurant and they usually get the order confirmations emailed to them and that gets printed afterwards. I realized that with this contribution, the one who places the order gets some nice html emails, but the admin does not. Quote Link to comment Share on other sites More sharing options...
npn2531 Posted July 2, 2013 Author Share Posted July 2, 2013 open catalog/includes/modules/mail_manager/order_confirm.php find: //send email tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt); add directly underneath: //send extra email to store owner tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt); Be sure you test this vaggolena 1 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
Backard Posted July 5, 2013 Share Posted July 5, 2013 Hi, I just started to use this addon to send out around 2500 emails. It worked well up to 1130 then it was stuck and sent all emails to same adress, over and over again. I altered mmstatus to 9 for that adress and run the script again. The next five emails was sent and then it hanged again and repeated same adress. Anybody have a clue how to fix this? Quote // Buck Link to comment Share on other sites More sharing options...
npn2531 Posted July 5, 2013 Author Share Posted July 5, 2013 What are the values of customers_newsletter and mmstatus in the customers table of the email that is hanging up? Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
Backard Posted July 5, 2013 Share Posted July 5, 2013 I think I solved it. The problem was duplicate email adresses on some customers. I changed this tep_db_query("UPDATE ".TABLE_CUSTOMERS." SET mmstatus = '9' WHERE customers_email_address ='" . $email . "' Limit 1"); to tep_db_query("UPDATE ".TABLE_CUSTOMERS." SET mmstatus = '9' WHERE customers_email_address ='" . $email . "' "); I just removed the limit, so now hopefully all customers ust receice the message once regardless how many names/addresses registered with same email address Quote // Buck Link to comment Share on other sites More sharing options...
Backard Posted July 5, 2013 Share Posted July 5, 2013 What are the values of customers_newsletter and mmstatus in the customers table of the email that is hanging up? The mmstatus value was 0. It was sent to all customers. Quote // Buck Link to comment Share on other sites More sharing options...
npn2531 Posted July 5, 2013 Author Share Posted July 5, 2013 The duplicate email issue is a problem, and could explain the endless loop. If you have two records with the same email address, then mail manager could be sending email to the first record, but updating the second record. Thus it would look like to mail manager that the first record has not been emailed, and it would get emailed again and again. OSCommerce as installed does not allow duplicate emails. Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
Fyod Posted July 7, 2013 Share Posted July 7, 2013 If you find a fix for this I'd love to see it. The preview does the same thing to my admin. I suspect it is because the email templates use inline styling, and are basically made to be stand alone html documents that will display in the recipients email box, and have no connection to the admin's CSS styling or programing. Hi Jase, seems it's just the <body> tags causing this. I haven't yet tested whether the emails would work ok without a body tag, which would solve it. I guess another way around it would be to open templates in a blank window. Quote Link to comment Share on other sites More sharing options...
npn2531 Posted July 7, 2013 Author Share Posted July 7, 2013 (edited) Opening templates in a blank unformatted window is a great idea, or perhaps have it open in a mailing program as if you were going to email it. Edited July 7, 2013 by npn2531 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
vaggolena Posted July 8, 2013 Share Posted July 8, 2013 open catalog/includes/modules/mail_manager/order_confirm.php find: //send email tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt); add directly underneath: //send extra email to store owner tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt); Be sure you test this Jase, This worked perfectly! Now wondering if there is a way to disable the non-html email to be sent as well after this html email. Each order I place creates the html email with the template and then the standard non html email as well. Quote Link to comment Share on other sites More sharing options...
npn2531 Posted July 8, 2013 Author Share Posted July 8, 2013 (edited) Now wondering if there is a way to disable the non-html email to be sent as well after this html email. Each order I place creates the html email with the template and then the standard non html email as well. I'm not clear if you are saying that everyone on your email list gets two emails, or just you, the administrator? Mail Manager only sends one email. That single email contains both the html and the plain text alternative. You, or the email recipient, uses the mailing program used to read email to choose which alternative displays in your email box. Edited July 8, 2013 by npn2531 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
vaggolena Posted July 9, 2013 Share Posted July 9, 2013 I'm not clear if you are saying that everyone on your email list gets two emails, or just you, the administrator? Mail Manager only sends one email. That single email contains both the html and the plain text alternative. You, or the email recipient, uses the mailing program used to read email to choose which alternative displays in your email box. Exactly, the one who places the order receives both the html and plain text email. Is that for redundant reasons? If so, can I disable the plain text? Quote Link to comment Share on other sites More sharing options...
npn2531 Posted July 9, 2013 Author Share Posted July 9, 2013 You can simply not fill in the plain text in the admin in mail manager when you compose your email. However note that all emails can have a plain text alternative anyway embedded in the email. Go to your preferred mail program and find the option to read the email source. You will see that there is always a text alternative. If you don't fill in the plain text, and send the email, and the recipient has his email set to display plain text, then they will see a text rendering of your html email which can be difficult to read. vaggolena 1 Quote Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.