Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Phpmailer For Oscommerce


naylwin

Recommended Posts

First of all, make user you have followed all the steps from README_TO_INSTALL file. If you can't find the file, you can read the online version here.

If your SMTP server requires authentication, then read my post #10 here.

Next, make sure you have configured the email setting in osC correctly. You can check this setting in Admin area by going to http://www.yourdomain/your_store_folder/ad...nfiguration.php

Configuration->E-Mail Options->Verify E-Mail Addresses Through DNS

If you have set this option to True, then try setting it to false and see if that solves your problem.

 

Other than that you have to make sure your Reverse DNS set for your domain. By contacting your host provider, you verify this step.

 

Hope this help.

 

Nay

 

First let me thanks you for the help I was begining to worry about this problem =).

 

Ok now, I check everything you tell me I follow the steps one by one everything is ok.

The Verify E-Mail Addresses Through DNS is on false.

and the SMTP server requires authentication is fine to.

 

I think that the problem is want you say about DNS for my domain y will contact my host provider and check that.

 

Other think I want to consult you is about the port when I check te configuration of my Email's its says port 26 for the SMTP but the real port for SMTP is port 25 so, what port should I use for the configuration?

 

Thaks a millon Nay.

 

Andy

Link to comment
Share on other sites

First let me thanks you for the help I was begining to worry about this problem =).

 

Ok now, I check everything you tell me I follow the steps one by one everything is ok.

The Verify E-Mail Addresses Through DNS is on false.

and the SMTP server requires authentication is fine to.

 

I think that the problem is want you say about DNS for my domain y will contact my host provider and check that.

 

Other think I want to consult you is about the port when I check te configuration of my Email's its says port 26 for the SMTP but the real port for SMTP is port 25 so, what port should I use for the configuration?

 

Thaks a millon Nay.

 

Andy

 

Please double check with your hosting provider that what port number they are really using for SMTP. By default, most server use port 25 for SMTP connection. Whichever port number your host provider says, that is the one you should use.

 

However this more likely DNS issue rather than Port issue. Because you can send email to same domain then your port is correct. Check on DNSLookup for your domain and check Reverse DNS for your IP is correct. And Make sure you are using correct SMTP_MAIL_SERVER. Like I said, this can be confirmed with your hosting provider.

 

Nay

Link to comment
Share on other sites

Please double check with your hosting provider that what port number they are really using for SMTP. By default, most server use port 25 for SMTP connection. Whichever port number your host provider says, that is the one you should use.

 

However this more likely DNS issue rather than Port issue. Because you can send email to same domain then your port is correct. Check on DNSLookup for your domain and check Reverse DNS for your IP is correct. And Make sure you are using correct SMTP_MAIL_SERVER. Like I said, this can be confirmed with your hosting provider.

 

Nay

 

Thanks a million for all the help man.

 

I check all the files that you tell me once again to be sure that I have everything all right and find a mistake in general.php I forgot to put the smtp username and smtp pasword after fix that I try to send a Email and it works fine, but only for Gmail Yahoo and my domain, Hotmail did not receive it :(

 

Hope you can help me out.

 

Once again thanks for all the help you really help me out.

 

Andy

Link to comment
Share on other sites

Thanks a million for all the help man.

 

I check all the files that you tell me once again to be sure that I have everything all right and find a mistake in general.php I forgot to put the smtp username and smtp pasword after fix that I try to send a Email and it works fine, but only for Gmail Yahoo and my domain, Hotmail did not receive it :(

 

Hope you can help me out.

 

Once again thanks for all the help you really help me out.

 

Andy

 

 

What is your SMTP_MAIL_SERVER? If you cannot post it here, you IM me or you can check it in MS command prompt.

 

Let's say your SMTP_MAIL_SERVER is mail.example.com and your domain is example.com. Now you go to MS command prompt and type in nslookup mail.example.com and hit enter. Remember the returned IP address. After that type in nslookup example.com and hit enter. These two checks should return two different IPs. If your SMTP_MAIL_SERVER is different than your domain then you probably need to setup a host record aka "A" record. For example: your domain is www.example.com and your SMTP_MAIL_SERVER is smtp.someserver.com then most of the mail servers such as Google, Yahoo, and AOL may think your email as SPAM. Therefore, you need to contact Host Provider to create a host record such as "mail.example.com" pointing to the same IP that smtp.someserver.com is pointing.

 

If this is too complicated and advanced for you then you need to ask or pay someone to do all this setup for you. I believe most hosting provider should take care of this.

 

Good Luck!

Nay

Link to comment
Share on other sites

What is your SMTP_MAIL_SERVER? If you cannot post it here, you IM me or you can check it in MS command prompt.

 

Let's say your SMTP_MAIL_SERVER is mail.example.com and your domain is example.com. Now you go to MS command prompt and type in nslookup mail.example.com and hit enter. Remember the returned IP address. After that type in nslookup example.com and hit enter. These two checks should return two different IPs. If your SMTP_MAIL_SERVER is different than your domain then you probably need to setup a host record aka "A" record. For example: your domain is www.example.com and your SMTP_MAIL_SERVER is smtp.someserver.com then most of the mail servers such as Google, Yahoo, and AOL may think your email as SPAM. Therefore, you need to contact Host Provider to create a host record such as "mail.example.com" pointing to the same IP that smtp.someserver.com is pointing.

 

If this is too complicated and advanced for you then you need to ask or pay someone to do all this setup for you. I believe most hosting provider should take care of this.

 

Good Luck!

Nay

 

Ok just for make sure we are in same page when I say

 

"I forgot to put the smtp username and smtp pasword"

 

I talked about the file general.php whe you say in post 10 that we need to add this:

if (EMAIL_TRANSPORT == 'smtp'){
$message->IsSMTP(); // telling the class to use SMTP
$message->SMTPAuth = true;
$message->Username = SMTP_USERNAME;
$message->Password = SMTP_PASSWORD;
}else{

 

Ok know that we are in same page I compare the IP's from mail.mydomain.com and mydomain.com and they ware the same. for what I understend you say that if they ware different I need to do all the procces, but if they are the same what should I do to receive E-mails for Hotmail Clients?

 

Thanks for all the attencion

 

Andy

Link to comment
Share on other sites

  • 5 weeks later...
Solved!!!! Thanks

 

Hello

 

I wonder how the problem was solved.

I followed everything as described by you in your previous post.

 

My oscommerce is running on a Windows Vista installed with the EasyPHP.

On the same system, I installed the moodle 1.9

It worked perfectly well without much configuration. On moodle, there's the admin page to configure the SMTP setting.

Email sent out perfectly well with no troubles.

 

Then I run everything well with the OSCommerce except the email part.

From "Contact Me" page, email won't sent.

From admin side, The "Send Email" page also don't send out any email, even there's the green message "Notice: Email sent to ...."

 

I wonder if it is related to something regarding the Apache or the php.ini of the system.

Does the Apache extension do anything related?

 

My email is [email protected]. Looking forward to your reply.

Many thanks.

 

James

Link to comment
Share on other sites

Hello

 

I wonder how the problem was solved.

I followed everything as described by you in your previous post.

 

My oscommerce is running on a Windows Vista installed with the EasyPHP.

On the same system, I installed the moodle 1.9

It worked perfectly well without much configuration. On moodle, there's the admin page to configure the SMTP setting.

Email sent out perfectly well with no troubles.

 

Then I run everything well with the OSCommerce except the email part.

From "Contact Me" page, email won't sent.

From admin side, The "Send Email" page also don't send out any email, even there's the green message "Notice: Email sent to ...."

 

I wonder if it is related to something regarding the Apache or the php.ini of the system.

Does the Apache extension do anything related?

 

My email is [email protected]. Looking forward to your reply.

Many thanks.

 

James

 

Solved thanks

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for contribution! Works fine for me except checkout_process.php I use Fancier Invoice & Packing Slip 6.2

 

Got error because phpmailer use other email class

 

Fatal error: Cannot instantiate non-existent class: email in /includes/modules/email_invoice/email_invoice.php on line 95

 

How to forward email_invoice.php to the phpmailer?

 

<?php

/*
 $Id: email_invoice.php,v 6.1 2005/06/05 18:00:29 PopTheTop Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Why go through all the processing if we don't have to, to begin with?
// This is kind of a shortcoming of the tep mail function that only tests
// this value after the email has already been compiled
if (SEND_EMAILS == 'true') {
	// One could assume that if you want to send the HTML invoice then this would be redundant,
	// but if for some reason the store owner changed their mind and ceased all HTML emails but forgot
	// to disable this mod then this would still honor their decision and not add the extra overhead
	// of compiling the HTML version, ond only send the original text version 
	if (EMAIL_USE_HTML == 'true') {
			$ei_admin = DIR_FS_ADMIN;
			$ei_image_dir = HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES;
			$ei_template_dir = DIR_WS_MODULES . EMAIL_INVOICE_DIR . INVOICE_TEMPLATE_DIR;
			$ei_template_file = $ei_template_dir . EMAIL_TEMPLATE_FILE;
			$ei_temp_file = DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_CACHE_FILE;
			$ei_css_path = HTTP_SERVER . DIR_WS_CATALOG . $ei_template_dir;

			require(DIR_FS_ADMIN . DIR_WS_LANGUAGES . $language . "/" . FILENAME_ORDERS_INVOICE);

			$currencies = new currencies();
			$oID = $insert_id;
			$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
			$order = new order($oID);
			$date = date('M d, Y');

			ob_start();
			include($ei_template_file);
			//this can be done in one funciton call in PHP >= 4.3.0 but to keep it compatible, I use 2
			$ei_html_email = ob_get_contents();
			ob_end_clean();

			// Replace relative paths to absolute paths
			// and space since the email class adds tons of <br> tags if you don't
			// strip them out first
			$ei_search = array("\n", "\r");

			$ei_html_email = str_replace($ei_search, "", $ei_html_email);
			$ei_html_email = str_replace('src="images/', "src=\"$ei_image_dir", $ei_html_email);
	}

	// Build the standard email using OSC code
	$email_order =  STORE_NAME . "\n" . 
							EMAIL_SEPARATOR . "\n" . 
							EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
							EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
							EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

	if ($order->info['comments']) {
			$email_order .= tep_db_output($order->info['comments']) . "\n\n";
	 }

	$email_order .=		 EMAIL_TEXT_PRODUCTS . "\n" . 
					EMAIL_SEPARATOR . "\n" . 
					$products_ordered . 
					EMAIL_SEPARATOR . "\n";

	for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
			$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
	}

	if ($order->content_type != 'virtual') {
			$email_order .= "\n" .  EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
											EMAIL_SEPARATOR . "\n" .
											tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
	}

	$email_order .= "\n" .  EMAIL_TEXT_BILLING_ADDRESS . "\n" .
											EMAIL_SEPARATOR . "\n" .
									tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

	if (is_object($$payment)) {
			$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
					 EMAIL_SEPARATOR . "\n";
			$payment_class = $$payment;
			$email_order .= $payment_class->title . "\n\n";

			if ($payment_class->email_footer) {
					$email_order .= $payment_class->email_footer . "\n\n";
			}
	}

	// Add both versions to the email to accomodate people who see html and those that don't
	[color="#FF0000"]$ei_message = new email(array('X-Mailer: osCommerce Mailer'));[/color]

	// Build the text version
	$ei_text = strip_tags($email_order);

	if (!empty($ei_html_email)) {
			$ei_message->add_html($ei_html_email, $ei_text);
	} else {
			$ei_message->add_text($ei_text);
	}

	$ei_message->build_message();
	$ei_message->send($order->customer['name'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT);

	if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
			$ei_message->send(STORE_OWNER, SEND_EXTRA_ORDER_EMAILS_TO, $order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT);
	}
}

?>

Link to comment
Share on other sites

  • 1 month later...
Thanks for contribution! Works fine for me except checkout_process.php I use Fancier Invoice & Packing Slip 6.2

 

Got error because phpmailer use other email class

 

Fatal error: Cannot instantiate non-existent class: email in /includes/modules/email_invoice/email_invoice.php on line 95

 

How to forward email_invoice.php to the phpmailer?

 

<?php

/*
 $Id: email_invoice.php,v 6.1 2005/06/05 18:00:29 PopTheTop Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Why go through all the processing if we don't have to, to begin with?
// This is kind of a shortcoming of the tep mail function that only tests
// this value after the email has already been compiled
if (SEND_EMAILS == 'true') {
	// One could assume that if you want to send the HTML invoice then this would be redundant,
	// but if for some reason the store owner changed their mind and ceased all HTML emails but forgot
	// to disable this mod then this would still honor their decision and not add the extra overhead
	// of compiling the HTML version, ond only send the original text version 
	if (EMAIL_USE_HTML == 'true') {
			$ei_admin = DIR_FS_ADMIN;
			$ei_image_dir = HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES;
			$ei_template_dir = DIR_WS_MODULES . EMAIL_INVOICE_DIR . INVOICE_TEMPLATE_DIR;
			$ei_template_file = $ei_template_dir . EMAIL_TEMPLATE_FILE;
			$ei_temp_file = DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_CACHE_FILE;
			$ei_css_path = HTTP_SERVER . DIR_WS_CATALOG . $ei_template_dir;

			require(DIR_FS_ADMIN . DIR_WS_LANGUAGES . $language . "/" . FILENAME_ORDERS_INVOICE);

			$currencies = new currencies();
			$oID = $insert_id;
			$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
			$order = new order($oID);
			$date = date('M d, Y');

			ob_start();
			include($ei_template_file);
			//this can be done in one funciton call in PHP >= 4.3.0 but to keep it compatible, I use 2
			$ei_html_email = ob_get_contents();
			ob_end_clean();

			// Replace relative paths to absolute paths
			// and space since the email class adds tons of <br> tags if you don't
			// strip them out first
			$ei_search = array("\n", "\r");

			$ei_html_email = str_replace($ei_search, "", $ei_html_email);
			$ei_html_email = str_replace('src="images/', "src=\"$ei_image_dir", $ei_html_email);
	}

	// Build the standard email using OSC code
	$email_order =  STORE_NAME . "\n" . 
							EMAIL_SEPARATOR . "\n" . 
							EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
							EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
							EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

	if ($order->info['comments']) {
			$email_order .= tep_db_output($order->info['comments']) . "\n\n";
	 }

	$email_order .=		 EMAIL_TEXT_PRODUCTS . "\n" . 
					EMAIL_SEPARATOR . "\n" . 
					$products_ordered . 
					EMAIL_SEPARATOR . "\n";

	for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
			$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
	}

	if ($order->content_type != 'virtual') {
			$email_order .= "\n" .  EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
											EMAIL_SEPARATOR . "\n" .
											tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
	}

	$email_order .= "\n" .  EMAIL_TEXT_BILLING_ADDRESS . "\n" .
											EMAIL_SEPARATOR . "\n" .
									tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

	if (is_object($$payment)) {
			$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
					 EMAIL_SEPARATOR . "\n";
			$payment_class = $$payment;
			$email_order .= $payment_class->title . "\n\n";

			if ($payment_class->email_footer) {
					$email_order .= $payment_class->email_footer . "\n\n";
			}
	}

	// Add both versions to the email to accomodate people who see html and those that don't
	[color="#FF0000"]$ei_message = new email(array('X-Mailer: osCommerce Mailer'));[/color]

	// Build the text version
	$ei_text = strip_tags($email_order);

	if (!empty($ei_html_email)) {
			$ei_message->add_html($ei_html_email, $ei_text);
	} else {
			$ei_message->add_text($ei_text);
	}

	$ei_message->build_message();
	$ei_message->send($order->customer['name'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT);

	if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
			$ei_message->send(STORE_OWNER, SEND_EXTRA_ORDER_EMAILS_TO, $order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT);
	}
}

?>

 

 

make sure that you use tep_mail function everywhere in your osCommerce site.

Link to comment
Share on other sites

  • 1 month later...

here is my tep_mail from general.php

  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;

// Instantiate a new mail object
$message = new PHPMailer();

if (EMAIL_TRANSPORT == 'smtp'){
$message->IsSMTP(); // telling the class to use SMTP
$message->SMTPAuth = true;
$message->Username = SMTP_USERNAME;
$message->Password = SMTP_PASSWORD;
}else{
			//////(EMAIL_TRANSPORT == 'sendmail')
			//////You need to implement here if you are using sendmail
	}

	// Config
	$message->Host = SMTP_MAIL_SERVER; // SMTP server

	if( !tep_not_null($from_email_address) ) {
			$from_email_address = SMTP_SENDMAIL_FROM;
	}

	$message->From = $from_email_address;

	if( !tep_not_null($from_email_name) ) {
			$from_email_name = SMTP_FROMEMAIL_NAME;
	}

	$message->FromName = $from_email_name;

	if( !tep_not_null($to_name) ) {
			$to_name = '';
	}

	if( !tep_not_null($to_email_address) ) {
			return false;
	}

	$message->AddAddress($to_email_address, $to_name);

	$message->Subject = $email_subject;

// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
	  $message->Body = tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $email_text);
	  $message->AltBody = $text;
	  $message->IsHTML(true);
} else {
	  $message->Body = $text;
	  $message->IsHTML(false);
}

// Send message
if(!$message->Send()){
	   /*echo 'Email was not sent.';
	   echo 'Mailer error: ' . $message->ErrorInfo;*/
	   return false;
	}
 }

Link to comment
Share on other sites

  • 4 weeks later...

Please help!

I also have a problem with standart OSC newsletter module in admin

 

... /admin/newsletters.php?action=insert

says NO NEWSLETTER module

 

installation manual say nothing how to modify /admin/newsletters.php

 

I beleive this part of code must be modified somewhere

 

	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" . NEWSLETTER_SEPARATOR . "\n" . TEXT_NEWSLETTER_OPTOUT . "\n" .  HTTP_SERVER . DIR_WS_CATALOG . FILENAME_NEWS_OPTOUT . "?email=" . $mail['customers_email_address'] . "\n\n");
	$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) . "'");
}
 }

Link to comment
Share on other sites

  • 8 months later...

Hi davidph,

 

in the 'Step 4' of the contribution, where you add host and send_mail_from email address, you need to add authentication info also.

 

there are total of four files need to be updated for authentication.

 

first two files:

 

\catalog\includes\configure.php and

\catalog\admin\includes\configure.php

 

add:

 

 

to both files and change usernme and ********* to correct ones.

 

after that modified tep_mail functions from:

 

\catalog \includes\functions\general.php and

\catalog\admin\includes\functions\general.php

 

as below:

 

Find:

 

 

Add:

 

 

so it looks like:

 

 

 

This should help to solve your problem

 

Nay

 

 

 

hi after doing everything as you instructed i still cant send html email newsletter and product notification i have this error

Fatal error: Class 'email' not found in /home/www/bestsellersmobiles.org/online-store/admin/includes/modules/newsletters/product_notification.php on line 203

Newsletter Manager

Sending E-Mail Please wait .. sending emails ..

 

Please do not interrupt this process!

 

please help

 

br,

parot

Edited by loneparot
Link to comment
Share on other sites

  • 9 months later...

Solved!!!! Thanks

 

 

Hi Flavinho, Could you please post how you fixed your problem? There might be community members who have the same issue. It might help them solve their problem as well. Thanks in advance! :thumbsup:

Link to comment
Share on other sites

Man I dont know what I do but it works, now I can send emails to all service's =D

 

Thanks a million Nay you are god in earth xD

 

thanks again man

 

Andy

 

You are welcome Andy. Sorry for the late reply. :D

Link to comment
Share on other sites

hi after doing everything as you instructed i still cant send html email newsletter and product notification i have this error

Fatal error: Class 'email' not found in /home/www/bestsellersmobiles.org/online-store/admin/includes/modules/newsletters/product_notification.php on line 203

Newsletter Manager

Sending E-Mail Please wait .. sending emails ..

 

Please do not interrupt this process!

 

please help

 

br,

parot

 

 

Hi Parot, I believe this error is concerned with the newsletter module you have installed. Please check with the contributor who wrote this module. From my side, all I can say it to make sure that your newsletter module uses oscommerce default API function called "tep_mail" instead of sending custom email.

Edited by naylwin
Link to comment
Share on other sites

Please help!

I also have a problem with standart OSC newsletter module in admin

 

... /admin/newsletters.php?action=insert

says NO NEWSLETTER module

 

installation manual say nothing how to modify /admin/newsletters.php

 

I beleive this part of code must be modified somewhere

 

	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" . NEWSLETTER_SEPARATOR . "\n" . TEXT_NEWSLETTER_OPTOUT . "\n" .  HTTP_SERVER . DIR_WS_CATALOG . FILENAME_NEWS_OPTOUT . "?email=" . $mail['customers_email_address'] . "\n\n");
	$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) . "'");
}
 }

 

 

Hi there, that was original bug in oscommerce itself. The fix is simple as below:

 

The file you need to change is:

/catalog/admin/newsletters.php 

 

Look for on line 41:

if (empty($module)) {

 

and change it to:

if (empty($newsletter_module)) {

 

Original fix was found on the forum: http://www.oscommerce.com/forums/topic/280837-where-is-the-newsletter-module/

 

 

:sweating: (w00t) :D

Edited by naylwin
Link to comment
Share on other sites

  • 2 months later...

Hi Naylwin,

 

Thanks for your nice addon, it finaly works on my webshop. But, I have a little (noob?) question: don't you think it's a little dangerous to wirte down your smtp password in the config.php file? Altough CHMODded to 444, I think it's possible to read the file? Your opinion please.

 

Regards,

Martijn

Link to comment
Share on other sites

  • 2 months later...

Hi Nay,

Used your instruction for smtp authentication.

Thanks a lot!

Works fine now.

 

I want to change the layout of the mails phpmailer sents, where do i find them?

 

I am happy with your add-on!

Bye,

Wilco

Link to comment
Share on other sites

  • 8 months later...

hi,

I have installed this addon but I am not sure how to confirm it is working. I know this may sound silly but I have configured it to use and authenticated smtp email with u/n and p/w and connect to my exchange mail server and to test I disabled this user in exchange but still it sends the email . I have smpt setup in the php but I want to use this instead. I tried setting the E-Mail Transport Method to either sendmail or smpt and still is sends. How to I force it to use phpmailer?

Thanks

Colin

Thanks

Colin

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...