Jump to content
Latest News: (loading..)

Recommended Posts

I'm trying to configure smtp (with authentication) on osCommerce but it's sending it to mail of the store instead clients and as html.

I've followed this guide https://www.inmotionhosting.com/support/edu/oscommerce/testing-ecommerce-functionality/setting-up-smtp-with-oscommerce but I think this is out of date, also doesn't send it correctly.

But this tutorial isn't 100% correct and it's not sending correctly. Also all my mails are HTML with the mail manager addon, even set $pMail->IsHTML(true);  and some modifications using this variables: 

return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers));

I've installed the lastest version of PHPMailer but having some issues.

I've been looking but couldn't find anything else, I was wondering if anyone that uses SMTP with authentication can show how it really should be.

Share this post


Link to post
Share on other sites

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Thanks @tgely! Will try it soon.

This works with the latest version of PHPMailer or should simple use that?

I've saw that the code isn't yet PHP 7 compatibility at least at classes/email.php:

class email {
// ...
function email($headers = '') {

Which should be function __construct($headers = '') {

But that I can work later. Other question is about being also compatible with mail manager, all my mails are sent with a html template with that addon.

classes/email.php:

class emailMailManager extends email { 
  function add_html($html, $text = NULL, $images_dir = NULL) {
    $this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
    $this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
    if (isset($images_dir)) $this->find_html_images($images_dir);
  }
}

functions/general.php:

//sends it
function tep_mm_sendmail($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt) {
  $mimemessage = new emailMailManager(array('X-Mailer: ad/mail_manager.com'));
  // add html and alternative text version 
  $mimemessage->add_html($output_content_html, $output_content_txt);
  $mimemessage->build_message(); // encoding -> 76 character linebreak, replacements must be done before
  $mimemessage->send($mail, $email_address, $sender_name, $sender, $output_subject, '');
}

 

Share this post


Link to post
Share on other sites

@sinopia

email class figured out as a helper class to phpMailer. I dont know about emailMailManager but helper class could be good.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

@tgely Hi, sorry just to answer now.

I was using this function tep_mm_sendmail but now my emails are being blocked by Gmail. Because no SMTP authentication and now if I turn back and use sendmail still being blocked.

Share this post


Link to post
Share on other sites

Also I get this message: 


Warning: call_user_func() expects parameter 1 to be a valid callback, function 'tep_cfg_password' not found or invalid function name in /home/x/public_html/admin/includes/functions/general.php on line 1503

Share this post


Link to post
Share on other sites

Fatal error: Uncaught Error: Call to undefined function tep_cfg_input_password() in /home/x/public_html/admin/configuration.php(106) : eval()'d code:1 Stack trace: #0 /home/x/public_html/admin/configuration.php(106): eval() #1 {main} thrown in /home/x/public_html/admin/configuration.php(106) : eval()'d code on line 1

Share this post


Link to post
Share on other sites
Posted (edited)

This errors I could fix, but my mails are sent this way:

 

//send email and extra mail to xxxx@xxxxxxx.pt
tep_mm_sendmail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, strip_tags($output_content_txt));    
tep_mm_sendmail('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, strip_tags($output_content_txt));  
//if mail manager status update email 'inactive' process normally via oscommerce
}else{                        
       tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }

so to sent them via smtp as html mails should I use the tep_mail function as normal?

Edited by bonbec
Editing the email address to avoid spam

Share this post


Link to post
Share on other sites

@sinopia


I have just updated a little fix in Encodings what you could see in github link

This is recommended in utf8 enviroment (about my experiencies)

$phpMail->Encoding = 'quoted-printable';


The best testing mode in admin side when you can send emails to customers. Use your prsonal email address and you could see the results. Apply changes to admin side and test with the new helper class there.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×