Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Phpmailer For Oscommerce


naylwin

Recommended Posts

  • 2 weeks later...

I installed and tried to send email from admin and received:

 

Warning: smtpsend(/php/pearclass.smtp.php) [function.smtpsend]: failed to open stream: No such file or directory in C:\xampp\htdocs\catalog\admin\includes\classes\class.phpmailer.php on line 460

 

Warning: smtpsend() [function.include]: Failed opening '/php/pearclass.smtp.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\catalog\admin\includes\classes\class.phpmailer.php on line 460

 

Fatal error: Cannot instantiate non-existent class: smtp in C:\xampp\htdocs\catalog\admin\includes\classes\class.phpmailer.php on line 527

 

Any ideas? :blink:

 

Thanks

Link to comment
Share on other sites

I installed and tried to send email from admin and received:

 

Warning: smtpsend(/php/pearclass.smtp.php) [function.smtpsend]: failed to open stream: No such file or directory in C:\xampp\htdocs\catalog\admin\includes\classes\class.phpmailer.php on line 460

 

Warning: smtpsend() [function.include]: Failed opening '/php/pearclass.smtp.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\catalog\admin\includes\classes\class.phpmailer.php on line 460

 

Fatal error: Cannot instantiate non-existent class: smtp in C:\xampp\htdocs\catalog\admin\includes\classes\class.phpmailer.php on line 527

 

Any ideas? :blink:

 

Thanks

 

Sorry for taking a while to response you. First of all, please make sure that you uploaded BOTH class.phpmailer.php and class.smtp.php to C:\xampp\htdocs\catalog\admin\includes\classes\ and second make sure that you change the code in C:\xampp\htdocs\catalog\admin\includes\application_top.php as below:

 

/* -- PHPMailer

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

*/

 

require(DIR_WS_CLASSES . 'class.phpmailer.php');

 

This should work fine and also make sure that you did not change any code in class.phpmailer.php and class.smtp.php. If you change anything let me know what you have changed, that me be causing this error.

 

Nay

Link to comment
Share on other sites

PHPMailer supports html email and perfect for Windows/IIS/SMTP

 

[Please note that I rarely have time to come to this forum. So, please be patient for the reply. Thanks]

Does this work on the web?

Link to comment
Share on other sites

Sorry for taking a while to response you. First of all, please make sure that you uploaded BOTH class.phpmailer.php and class.smtp.php to C:\xampp\htdocs\catalog\admin\includes\classes\ and second make sure that you change the code in C:\xampp\htdocs\catalog\admin\includes\application_top.php as below:

 

/* -- PHPMailer

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

*/

 

require(DIR_WS_CLASSES . 'class.phpmailer.php');

 

This should work fine and also make sure that you did not change any code in class.phpmailer.php and class.smtp.php. If you change anything let me know what you have changed, that me be causing this error.

 

Nay

 

Thanks for the help, that cleared up that error.

Network guy is telling me I need a password to send to the mail server. How do I add that in?

Link to comment
Share on other sites

a little offtopic but:

 

If anyone cares I use a php class called xpertmailer so send emails from my osc shop. This class can use my gmail account (i dont use gmail though). I just include() the class file into email.php from oscommerce and modify a few lines in the smtp section of

email.php.

Link to comment
Share on other sites

I think you should note that additional files may have to be altered - otherwise you'll get errors on any other processes that use the mail function. When I have more time, I'll investigate whether the lines in application_top that require the mail class really need to be commented out. Without requiring the mail class there, you get errors on newsletters and on account-related e-mails, to begin with.

Link to comment
Share on other sites

Does this work on the web?

 

 

Sure ! it works fine. I tested on Windows/SMTP with and without Authentication.

You can even use SMTP sitting on totally different server with Authentication.

 

All you have to do is setup correct host and username and password

 

Thanks,

 

Nay

Link to comment
Share on other sites

I think you should note that additional files may have to be altered - otherwise you'll get errors on any other processes that use the mail function. When I have more time, I'll investigate whether the lines in application_top that require the mail class really need to be commented out. Without requiring the mail class there, you get errors on newsletters and on account-related e-mails, to begin with.

 

 

Hi kymar

 

Most of the emails that send out by Oscommerce used tep_mail function. Since 'Step 6' in this contribution took care of the tep_mail functions in catalog and admin, and 'Step 7' took care of the email send out to customer individually or group or newsletter subscribers, there should be no problem to comment out:

 

/*

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

*/

 

Unless you have installed other contributions that uses email.php and mime.php.

Also please note that this contribution does not work if you use 'sendmail'.

 

Thanks,

 

Nay

Link to comment
Share on other sites

Thanks for the help, that cleared up that error.

Network guy is telling me I need a password to send to the mail server. How do I add that in?

 

 

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:

define('SMTP_USERNAME', 'username');

define('SMTP_PASSWORD', '*******');

 

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:

if (EMAIL_TRANSPORT == 'smtp'){

$message->IsSMTP(); // telling the class to use SMTP

}else{

 

Add:

$message->SMTPAuth = true;

$message->Username = SMTP_USERNAME;

$message->Password = SMTP_PASSWORD;

 

so it looks like:

if (EMAIL_TRANSPORT == 'smtp'){

$message->IsSMTP(); // telling the class to use SMTP

$message->SMTPAuth = true;

$message->Username = SMTP_USERNAME;

$message->Password = SMTP_PASSWORD;

}else{

 

 

This should help to solve your problem

 

Nay

Link to comment
Share on other sites

  • 2 months later...

Im now getting emails being sent out THANKS a billion... But all the emails are coming out wierd... firstly there is this:

 

--=_e7f7e641a1bb42db2123c6daf4242216

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

 

Mobo jumbo at the top of every email... secondly there is a second transcript of my email content at the botton of the email, which contains all the <b> <br> tags and stuff... Can you help me out please :).

 

Adam

Link to comment
Share on other sites

Im now getting emails being sent out THANKS a billion... But all the emails are coming out wierd... firstly there is this:

 

--=_e7f7e641a1bb42db2123c6daf4242216

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

 

Mobo jumbo at the top of every email... secondly there is a second transcript of my email content at the botton of the email, which contains all the <b> <br> tags and stuff... Can you help me out please :).

 

Adam

 

 

Hi Adam,

 

first of all, I want you to check in ADMIN panel, and make sure you have the following settings; these are for Windows OS and SMTP.

 

 

Configuration ->

E-Mail Options ->

E-Mail Transport Method -> SMTP

E-Mail Linefeeds -> CRLF

Use MIME HTML When Sending Emails -> TRUE

 

if the problem still exists, check your email client, may be your email provider does not support HTML Email. Or try disabling the HTML E-Mail.

 

For Example, set Use MIME HTML When Sending Emails -> FALSE

 

Good Luck

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi

 

I've followed these instructions, email from the store works fine, i.e. send new password, enquiry, etc. But email sent from the Admin section doesn't work, regardless of it informing me that the email has been sent!

 

Any help/advice

 

Karl.

Link to comment
Share on other sites

  • 3 weeks later...
Hi

 

I've followed these instructions, email from the store works fine, i.e. send new password, enquiry, etc. But email sent from the Admin section doesn't work, regardless of it informing me that the email has been sent!

 

Any help/advice

 

Karl.

 

Please make sure that you have followed the instruction on Step 3 to 7 for the following files:

  • Upload class.phpmailer.php and class.smtp.php to \catalog\admin\includes\classes\

  • catalog\admin\includes\configure.php

  • catalog\admin\includes\application_top.php

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

  • catalog\admin\mail.php

 

read the instruction here : http://woodcraftsrus.com/osCommerce/PHPMai..._TO_INSTALL.htm

Link to comment
Share on other sites

  • 4 months later...
Please make sure that you have followed the instruction on Step 3 to 7 for the following files:

  • Upload class.phpmailer.php and class.smtp.php to \catalog\admin\includes\classes\

  • catalog\admin\includes\configure.php

  • catalog\admin\includes\application_top.php

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

  • catalog\admin\mail.php

 

read the instruction here : http://woodcraftsrus.com/osCommerce/PHPMai..._TO_INSTALL.htm

I have followed your instructions to the letter. I have checked it four times to make sure.

It doesn't work for me, of course I know nothing. I have a forum also and the emal works fine, but I just can't get it to work in oscommerce. I get no error messages at all, it just doesn't send or recieve.

Thanks Bo

Edited by badbo
Link to comment
Share on other sites

what about newsletters?

 

i can sent a mail to administrator

customers receive confirmation when they create new account

customers recive confirmation when the put a new order

 

but as administrator

i cant

 

send mail to a customer

sent any type of newsletter

 

PLZ HELP ASAP

Link to comment
Share on other sites

what about newsletters?

 

i can sent a mail to administrator

customers receive confirmation when they create new account

customers recive confirmation when the put a new order

 

but as administrator

i cant

 

send mail to a customer

sent any type of newsletter

 

PLZ HELP ASAP

 

As far as I can understand, you want to receive an email as an admin when someone create account or make order. And you want to know whether you can send newsletter using PHPMailer.

 

> First, if someone create an account, osC doesn't send email to Admin unless you have custom programmed. If you need to custom program, look into catalog/create_account.php file and look for tep_mail(...) function and update to add extra email address.

 

> Second, osC has feature that you can have osC sends extra order emails, when some make an order. To do this, log on to Admin are and go to Configuration/My Store/Send Extra Order Emails To and add the admin Email here.

 

> Finally, whichever newsletter program or script you are using, you must make sure that the newsletter program or script uses tep_mail(...) function from catalog/admin/includes/functions/general.php file. And your store must fully be installed "PHPMailer for OsCommerce" contribution.

 

 

P.S. Please next time, ask specific question :)

 

Nay

Link to comment
Share on other sites

I have followed your instructions to the letter. I have checked it four times to make sure.

It doesn't work for me, of course I know nothing. I have a forum also and the emal works fine, but I just can't get it to work in oscommerce. I get no error messages at all, it just doesn't send or recieve.

Thanks Bo

 

 

Not sure what exactly causes the problem. However, please be advised that this contribution is intended for Windows sever with SMTP. If you are on *NIX platform with sendmail enabled, I would recommend you use the osC default email system.

 

If you are on Window/IIS/SMTP, then please make sure you have all the settings in ADMIN Area are correct. For example, Configuration/Email Options/Email Transport Method is sent to SMTP, Line feed is CRLF, and Send Emails is set to true.

 

If your server requires SMTP authentication, then please read my post above http://www.oscommerce.com/forums/index.php?sho...t&p=1107287

 

Nay

Link to comment
Share on other sites

Not sure what exactly causes the problem. However, please be advised that this contribution is intended for Windows sever with SMTP. If you are on *NIX platform with sendmail enabled, I would recommend you use the osC default email system.

 

If you are on Window/IIS/SMTP, then please make sure you have all the settings in ADMIN Area are correct. For example, Configuration/Email Options/Email Transport Method is sent to SMTP, Line feed is CRLF, and Send Emails is set to true.

 

If your server requires SMTP authentication, then please read my post above http://www.oscommerce.com/forums/index.php?sho...t&p=1107287

 

Nay

 

Thanks Nay I will give an update I got the email working. Thanks again.

Bo

Link to comment
Share on other sites

  • 1 month later...

Hello.

I’ve been trying to send and receive e-mail but nothing! 

I made your tutorial and nothing 

I’m trying to set up my terra mail to work

 

My smtp server = smtp.sao.terra.com.br

My e-mail = [email protected]

And o course my user name [email protected]

 

My configure.php file (in admin and catalog folder) ends this way (server requires authentication):

 

define('SMTP_MAIL_SERVER', 'smtp.sao.terra.com.br');

define('SMTP_PORT_NUMBER', '25');

define('SMTP_SENDMAIL_FROM', '[email protected]');

define('SMTP_FROMEMAIL_NAME', 'Forte Real');

define('SMTP_USERNAME', '[email protected]');

define('SMTP_PASSWORD', '******');

?>

 

Aplication_top.php ==============================================

 

// include currencies class and create an instance

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

// include the mail classes

/* Nay -- PHPMailer

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

*/

require(DIR_WS_CLASSES . 'class.phpmailer.php');

 

/* End Nay */

 

 

// set the language

if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {

if (!tep_session_is_registered('language')) {

tep_session_register('language');

tep_session_register('languages_id');

}

 

 

Admin aplication_top.php ==================================

// entry/item info classes

require(DIR_WS_CLASSES . 'object_info.php');

 

// email classes

/* Nay -- PHPMailer

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

*/

require(DIR_WS_CLASSES . 'class.phpmailer.php');

 

/* End Nay */

 

 

// file uploading class

require(DIR_WS_CLASSES . 'upload.php');

 

 

admin general.php =========================================

 

} else {

$value .= '.';

for ($i=0; $i<$padding; $i++) {

$value .= '0';

}

}

}

 

return $value;

}

 

/*

 

Old Function:

 

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 email(array('X-Mailer: osCommerce'));

 

// Build the text version

$text = strip_tags($email_text);

if (EMAIL_USE_HTML == 'true') {

$message->add_html($email_text, $text);

} else {

$message->add_text($text);

}

 

// Send message

$message->build_message();

$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);

}

 

//Email using PHP Mailer

//Edited by Nay

*/

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;

}

}

 

 

function tep_get_tax_class_title($tax_class_id) {

 

 

general.php ====================================================

 

// $email_subject The subject of the eMail

// $email_text The text of the eMail, may contain HTML entities

// $from_email_name The name of the sender, e.g. Shop Administration

// $from_email_adress The eMail address of the sender,

// e.g. [email protected]

 

/*

 

Old Function:

 

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 email(array('X-Mailer: osCommerce'));

 

// Build the text version

$text = strip_tags($email_text);

if (EMAIL_USE_HTML == 'true') {

$message->add_html($email_text, $text);

} else {

$message->add_text($text);

}

 

// Send message

$message->build_message();

$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);

}

 

//Email using PHP Mailer

//Edited by Nay

*/

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;

}

}

 

 

////

// Check if product has attributes

function tep_has_product_attributes($products_id) {

 

 

admin mail.php ======================================================

 

$message = tep_db_prepare_input($HTTP_POST_VARS['message']);

 

/*

Nay -- Edited

-- Email Using PHP Mailer

Old Code:

//Let's build a message object using the email class

$mimemessage = new email(array('X-Mailer: osCommerce'));

// add the message to the object

$mimemessage->add_text($message);

$mimemessage->build_message();

while ($mail = tep_db_fetch_array($mail_query)) {

$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);

}

 

*/

while ($mail = tep_db_fetch_array($mail_query)) {

tep_mail($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], $subject, $message, STORE_OWNER, $from);

}

 

/* End Nay */

 

 

tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));

}

 

 

 

I have uploaded the two files class.phpmailer and class.smtp to both classes folders

 

My admin panel e-mail options:

 

E-Mail Transport Method = smtp

E-Mail Linefeeds = CRLF

Use MIME HTML When Sending Emails = TRUE

Verify E-Mail Addresses Through DNS = FALSE

Send E-Mails = TRUE

 

My store options:

 

E-mail address [email protected]

E-mail from [email protected]

 

Send Extra Order Emails To “nothing here”

 

What is wrong?? Any idea???

Thanks a lot!!!!

Link to comment
Share on other sites

  • 3 weeks later...

Hope someone still looking at this post.

 

Hi the other day I was trying to put PHPMailer in my OsC Store and it works , now I can send emails from my admin panel without any errors but the only think I cant do is sent emails to another domain.

 

I'm using the last version of OsC v. 2.2 RC2

and the last version of PHPMailer v. 2.0.2

 

Example of the problem:

 

From my email [email protected] I can send emails to [email protected]

but

From [email protected] I cant send emails to [email protected] or [email protected]

 

Thanks

 

Andy

Link to comment
Share on other sites

Hope someone still looking at this post.

 

Hi the other day I was trying to put PHPMailer in my OsC Store and it works , now I can send emails from my admin panel without any errors but the only think I cant do is sent emails to another domain.

 

I'm using the last version of OsC v. 2.2 RC2

and the last version of PHPMailer v. 2.0.2

 

Example of the problem:

 

From my email [email protected] I can send emails to [email protected]

but

From [email protected] I cant send emails to [email protected] or [email protected]

 

Thanks

 

Andy

 

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

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