wizardsandwars Posted January 23, 2003 Share Posted January 23, 2003 In particular, I'm trying to find exactly where the emails are actually being sent for newsletters and product notifications. I'd like to add a dynamic link to them. I thought that it was in /admin/includes/modules/newsletter.php where it says: $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message($this->content); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } and in /admin/includes/modules/product_notification.php where it has $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text(nothing); $mimemessage->build_message($this->content); reset($audience); while (list($key, $value) = each ($audience)) { $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->title); } Obviously, I am wrong in both cases, because If I comment out this code entirely, newsletters and notifications are still sent out. Could someone help me sort this out, please? ------------------------------------------------------------------------------------------------------------------------- NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit. If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help. Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 23, 2003 Share Posted January 23, 2003 You have four places in admin where mail is sent: - in includes/modules/newsletters/newsletter.php with ->send() - in includes/modules/newsletters/product_notification.php with ->send() - in newsletters.php with ->send() - in mail.php with ->send() You also have an occurence of ->send() in includes/functions/general.php where it's used in tep_mail(), but tep_mail() is not used. Try newsletters.php or mail.php. You might have made a mistake during testing, though. Christian Lescuyer Link to comment Share on other sites More sharing options...
wizardsandwars Posted January 23, 2003 Author Share Posted January 23, 2003 Well, what I suspect is sending the newsletter out is this in admin/newsletter.php $module->send($nInfo->newsletters_id); However, I thought that this was "calling" a function that I found in /admin/includes/modules/newsletter.php function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message($this->content); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } Now, I'm not so sure that this is the case, becsue if I comment out the function entirely, and send a newseltter, the newsletter still gets sent. ------------------------------------------------------------------------------------------------------------------------- NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit. If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help. Link to comment Share on other sites More sharing options...
wizardsandwars Posted January 23, 2003 Author Share Posted January 23, 2003 OK, so I know for a fact that this line in /admin/newsletter.php is what sends the newsletter. $module->send($nInfo->newsletters_id); The problem I have is that I am unable to find a way to add dynamic content to the newsletter depending on the customer. So If I wanted to , for instance, add the customers email to the bottom of the text of the newsletter. I can't just add it to the content above, because at this point, we have not begun to cycle through the customers to mail each one yet. I need to add the dynamic content at the point where we cycle through the customers. Unfortunaly, I'm not able to find where this happens. As I said in the post above, it does not seem to be in the "send" function of hte /admin/includes/newsletter.php. ------------------------------------------------------------------------------------------------------------------------- NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit. If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help. Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 24, 2003 Share Posted January 24, 2003 Sorry if I'm thick, but I have this in includes/modules/newsletter/newsletter.php: function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->add_text($this->content . "n-- n" . 'Sent to ' . $mail['customers_email_address']); $mimemessage->build_message(); $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } $newsletter_id = tep_db_prepare_input($newsletter_id); tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'"); } And this is the mail I receive: tezdz-- Sent to [email protected] (Not great litterature :o ) I don't see a problem here? Christian Lescuyer Link to comment Share on other sites More sharing options...
wizardsandwars Posted January 24, 2003 Author Share Posted January 24, 2003 Oh my God. I hate when I spend like 3 days on one little programming problem, and then you find out that's its really somthing little and stupid. The problem was, that I have been looking at the send function in two files. /admin/includes/modules/newsletter.php and /admin/includes/modules/product_notification.php But I look in the file that you suggest,... admin/includes/modules/newsletters/newsletter.php ...and Bob's your Uncle, there it is! My contribution will be forthcomming this evening. :D Welll, at least I know a little morte about OO in PHP, now. :roll: Thanks for your patience. ------------------------------------------------------------------------------------------------------------------------- NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit. If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help. Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 24, 2003 Share Posted January 24, 2003 Oh, happens to me all the time :shock: Christian Lescuyer Link to comment Share on other sites More sharing options...
wizardsandwars Posted January 24, 2003 Author Share Posted January 24, 2003 Well, unfortunatly, it looks as if that didn't do it either. This is how I altered the /admin/includes/modules/newsletters/newsletter.php script. function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); while ($mail = tep_db_fetch_array($mail_query)) { [b]$mimemessage->add_text($this->content . 'nhttp://www.wizardsandwars.com/unsubscribe.php?email=' . $mail['customers_email_address']);[/b] $mimemessage->build_message(); $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } $newsletter_id = tep_db_prepare_input($newsletter_id); tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'"); } } Afterwards, I created a newsletter, made it of type "product notification", clicked send, selected a product that I know that only I have notification on for, and clicked send. I received the notification, but it did not have the amendment. I have also tried to alter the "send" function in the followin scripts: /public_html/admin/includes/modules/newsletter.php /public_html/admin/mail.php /public_html/admin/includes/modules/product_notification.php All of which have been to no avail. Any help would be greatly appreciated. ------------------------------------------------------------------------------------------------------------------------- NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit. If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help. Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 24, 2003 Share Posted January 24, 2003 I created a newsletter, made it of type "product notification" I would imagine that a "product notification" type newsletter actually used the admin/includes/modules/newsletters/product_notification.php... which is the other file in the directory. I'm not very familiar with product notifications. (I learned how to send them recently in this forum). I imagine it's quite similar to the newsletters, apart from the product/client matching logic. Christian Lescuyer Link to comment Share on other sites More sharing options...
wizardsandwars Posted January 24, 2003 Author Share Posted January 24, 2003 What an idiot I am. :oops: I am so convinced that I've already checked that file, that I completly overlook the obvious. Well, that's it then. I've got it. With luck, I should be able to handle it from here. ------------------------------------------------------------------------------------------------------------------------- NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit. If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.