multimixer Posted November 13, 2015 Share Posted November 13, 2015 @@Flotec In the older php mailer versions you had somewhere following line in file includes/classes/email.php require_once 'ext/modules/phpmailer/class.phpmailer.php'; For the newest php mailer version you need this here instead includes/classes/email.php require_once('ext/modules/phpmailer/PHPMailerAutoload.php'); admin/includes/classes/email.php require_once(DIR_FS_CATALOG . 'ext/modules/phpmailer/PHPMailerAutoload.php'); There are also some changes in the function names etc within the phpmailer classes, so you need to change the way you are calling them Here is an example of a site that use that within function send() require_once('ext/modules/phpmailer/PHPMailerAutoload.php'); $pmail = new PHPMailer; $pmail->isSMTP(); $pmail->isHTML(true); $pmail->Host = ""; $pmail->Port = 25; $pmail->SMTPAuth = true; $mail->Username = ""; $mail->Password = ""; $pmail->CharSet = "utf-8"; $pmail->setFrom($from_addr, $from_name); $pmail->addAddress($to_addr, $to_name); $pmail->Subject = $subject; $pmail->Body = $this->html; $pmail->AltBody = $this->text;; if (!$pmail->send()) { return false; } else { $pmail->clearAddresses(); $pmail->clearAttachments(); return true; } Your code may be different, this is just for reference not to copy/paste My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
douglaswalker Posted November 13, 2015 Share Posted November 13, 2015 Also have a look at Mandril Gary Burton has a mod that takes advantage of Mandrils API. Super simple (well the set up is ... not the coding) Doug Link to comment Share on other sites More sharing options...
Flotec Posted November 13, 2015 Share Posted November 13, 2015 When I changed includes/classes/email.php I got this error Warning: require_once(/home/flotecmari2/public_html/ext/modules/phpmailer/PHPMailerAutoload.php): failed to open stream: No such file or directory in /home/flotecmari2/public_html/admin/includes/classes/email.php on line 16Fatal error: require_once(): Failed opening required '/home/flotecmari2/public_html/ext/modules/phpmailer/PHPMailerAutoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/flotecmari2/public_html/admin/includes/classes/email.php on line 16 I don't understand the last part. Link to comment Share on other sites More sharing options...
Flotec Posted November 13, 2015 Share Posted November 13, 2015 In admin/inludes/configure.php i find this: define('DIR_FS_CATALOG', '/home/myplace/public_html/'); Looks OK doesn't it. So why look for the files under admin? Link to comment Share on other sites More sharing options...
Flotec Posted November 13, 2015 Share Posted November 13, 2015 I think the two email.php files I have are very old. Where can I find new ones? Link to comment Share on other sites More sharing options...
multimixer Posted November 13, 2015 Share Posted November 13, 2015 @@Flotec Make sure the path to the file you are using is correct, it may be different than what I posted According to your previous post, the paths should be for you includes/classes/email.php require_once('ext/modules/PHPMailer/PHPMailerAutoload.php'); admin/includes/classes/email.php require_once(DIR_FS_CATALOG . 'ext/modules/PHPMailer/PHPMailerAutoload.php'); My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
Flotec Posted November 13, 2015 Share Posted November 13, 2015 When I use contact us I receive this new error message: Warning: stream_socket_enable_crypto(): Peer certificate CN=`*.anx.se' did not match expected CN=`my_smtp_server' in /home/flotecmari2/public_html/ext/modules/PHPMailer/class.smtp.php on line 344 Again the email.php files I have does not look like the example you gave me before. I think the problem is in these files. Last time I got the recommendation from Gergely to download new ones here: https://github.com/G...asses/email.php That link does not work anymore. Link to comment Share on other sites More sharing options...
Flotec Posted November 13, 2015 Share Posted November 13, 2015 This is my includes/classes/email.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License email is a class to assist with PHPmailer sendmail, SMTP and gmail compatibility */ require_once('ext/modules/PHPMailer/PHPMailerAutoload.php'); $phpMail = new PHPMailer(); class email { var $html; var $text; var $html_text; var $lf; var $debug = 0; var $debug_output = 'error_log'; function email($headers = '') { global $phpMail; $phpMail->XMailer = 'osCommerce ' . tep_get_version(); $phpMail->SMTPDebug = $this->debug; $phpMail->Debugoutput = $this->debug_output; $phpMail->CharSet = CHARSET; $phpMail->WordWrap = 998; if (EMAIL_LINEFEED == 'CRLF') { $this->lf = "\r\n"; } else { $this->lf = "\n"; } } function add_text($text = '') { global $phpMail; $phpMail->IsHTML(false); $this->text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text); } function add_html($html, $text = NULL, $images_dir = NULL) { global $phpMail; $phpMail->IsHTML(true); $this->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->html = $phpMail->msgHTML($this->html, $images_dir); } function add_attachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') { global $phpMail; $phpMail->AddAttachment($path, $name, $encoding, $type, $disposition); } function build_message() { //out of work function } function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $reply_to = false) { global $phpMail; if ((strstr($to_name, "\n") != false) || (strstr($to_name, "\r") != false)) { return false; } if ((strstr($to_addr, "\n") != false) || (strstr($to_addr, "\r") != false)) { return false; } if ((strstr($subject, "\n") != false) || (strstr($subject, "\r") != false)) { return false; } if ((strstr($from_name, "\n") != false) || (strstr($from_name, "\r") != false)) { return false; } if ((strstr($from_addr, "\n") != false) || (strstr($from_addr, "\r") != false)) { return false; } $phpMail->From = $from_addr; $phpMail->FromName = $from_name; $phpMail->AddAddress($to_addr, $to_name); if ($reply_to) { $phpMail->AddReplyTo(EMAIL_SMTP_REPLYTO, STORE_NAME); } else { $phpMail->AddReplyTo($from_addr, $from_name); } $phpMail->Subject = $subject; if (!empty($this->html)) { $phpMail->Body = $this->html; $phpMail->AltBody = $this->html_text; } else { $phpMail->Body = $this->text; } if (EMAIL_TRANSPORT == 'smtp' || EMAIL_TRANSPORT == 'gmail') { $phpMail->IsSMTP(); $phpMail->Host = EMAIL_SMTP_HOSTS; $phpMail->SMTPAuth = EMAIL_SMTP_AUTHENTICATION; $phpMail->Username = EMAIL_SMTP_USER; $phpMail->Password = EMAIL_SMTP_PASSWORD; if (EMAIL_TRANSPORT == 'gmail') { $phpMail->Port = 465; $phpMail->SMTPSecure = 'ssl'; } } else { $phpMail->isSendmail(); } if (!$phpMail->Send()) { return false; } $phpMail->clearAddresses(); return true; } } ?> Link to comment Share on other sites More sharing options...
Flotec Posted November 16, 2015 Share Posted November 16, 2015 As I told you before I get this error: Warning: stream_socket_enable_crypto(): Peer certificate CN=`*.anx.se' did not match expected CN=`my_smtp_server' in /home/flotecmari2/public_html/ext/modules/PHPMailer/class.smtp.php on line 344 I some way I have to remove the verification. Found this on Internet: http://blog.zot24.com/how-to-solve-peer-certificate-cn-not-matching-in-php-with-cakephp/ Where can I insert this?: 'ssl_verify_host' => false I'm suprised that not more people are interested in this topic. Sending mails and using SMTP for this must be the most important thing for an e-shop to handle. Link to comment Share on other sites More sharing options...
tgely Posted November 16, 2015 Share Posted November 16, 2015 SSL was changed so I rewited mail.php class codebase one year ago: https://github.com/tgely/oscommerce2-1/blob/119977546d6bf3b9e66b8dd1c4b5a2581154d24c/catalog/admin/includes/classes/email.php 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. Link to comment Share on other sites More sharing options...
Flotec Posted November 17, 2015 Share Posted November 17, 2015 Hello Gergely Thank you for your answer but the file is wrong. Should start with this: require_once '../ext/modules/PHPMailer/PHPMailerAutoload.php'; If I change that and with debug activated (2) I get a time out: 2015-11-17 08:34:41 SMTP ERROR: Failed to connect to server: Connection timed out (110) 2015-11-17 08:34:41 SMTP connect() failed. Where do I set the port for outgoing mails? Before I had "$phpMail->Port = 465;" Link to comment Share on other sites More sharing options...
Flotec Posted November 17, 2015 Share Posted November 17, 2015 I think I made an error when I copied your email.php file. I now have this file and have made two corrections: - I changed first line to: require_once '../ext/modules/PHPMailer/PHPMailerAutoload.php'; - I changed line 35 from $phpMail->Port = EMAIL_SMTP_PORT; to $phpMail->Port = 465; When I sent an email from admin it was succes. Mail has been sent but I have still not received it. Waiting for that. It has to be an includes/classes/email.php also. Can you send that also? Link to comment Share on other sites More sharing options...
tgely Posted November 17, 2015 Share Posted November 17, 2015 https://github.com/tgely/oscommerce2-1/blob/119977546d6bf3b9e66b8dd1c4b5a2581154d24c/catalog/includes/classes/email.php 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. Link to comment Share on other sites More sharing options...
Flotec Posted November 17, 2015 Share Posted November 17, 2015 You have the same error in this file. Take a look here if don't believe me: https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Should be like this: require_once('ext/modules/PHPMailer/PHPMailerAutoload.php'); Anyway it does not work for me. I get either time out or no mail is sent. Link to comment Share on other sites More sharing options...
tgely Posted November 18, 2015 Share Posted November 18, 2015 I belive you but this project works on : $Version = '5.2.7'; 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. Link to comment Share on other sites More sharing options...
Flotec Posted November 18, 2015 Share Posted November 18, 2015 Is that PHP version you talk about. I am on a PHP 5.6.14 server and on that I get a fatal error. Anyway there are some undefined parameters included in your email.php files: - EMAIL_TRANSPORT - EMAIL_SMTP_PORT - EMAI_SMTP_SECURE Should be included in either the admin side or defined by running some mysql commands? There can be more? Link to comment Share on other sites More sharing options...
tgely Posted November 18, 2015 Share Posted November 18, 2015 here are all commits: https://github.com/osCommerce/oscommerce2/compare/master...tgely:PHPMailer?diff=split&name=PHPMailer 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. Link to comment Share on other sites More sharing options...
tgely Posted November 18, 2015 Share Posted November 18, 2015 here is the used function: https://github.com/tgely/oscommerce2-1/blob/PHPMailer/catalog/admin/includes/functions/general.php#L808you could download all: https://github.com/tgely/oscommerce2-1/tree/PHPMailer/catalog 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. Link to comment Share on other sites More sharing options...
piernas Posted September 7, 2016 Share Posted September 7, 2016 @@Gergely I'm trying to install your mod along with your HTML emails. For any reason email is only being sent from the contact us page, not from any of the templated pages. Do I need to modify something for making both mods work together? Link to comment Share on other sites More sharing options...
tgely Posted September 7, 2016 Share Posted September 7, 2016 @@Gergely I'm trying to install your mod along with your HTML emails. For any reason email is only being sent from the contact us page, not from any of the templated pages. Do I need to modify something for making both mods work together? contact_us page was not templated. As a shop owner I dont want templated messages to me. :) The mail conversation will be mixed so there is no reason to be "templated" contact emails. Would you like to send templated emails to admin? 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. Link to comment Share on other sites More sharing options...
piernas Posted September 7, 2016 Share Posted September 7, 2016 contact_us page was not templated. As a shop owner I dont want templated messages to me. :) The mail conversation will be mixed so there is no reason to be "templated" contact emails. Would you like to send templated emails to admin? I know, I meant the only page that sends emails is the contact us page, that has not template. No errors are displayed, but all the other email from other pages are not sent (no order confirmation or status changes). That's why I was asking if both contribs are compatible. Link to comment Share on other sites More sharing options...
tgely Posted September 7, 2016 Share Posted September 7, 2016 Yes its working together. Have you tried the SMTP debug first? 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. Link to comment Share on other sites More sharing options...
piernas Posted September 7, 2016 Share Posted September 7, 2016 Yes its working together. Have you tried the SMTP debug first? I did but no output was there. I've uninstalled the templates on the orders page and it works again; Will reinstall it and test in deep! Link to comment Share on other sites More sharing options...
tgely Posted September 8, 2016 Share Posted September 8, 2016 I did but no output was there. I've uninstalled the templates on the orders page and it works again; Will reinstall it and test in deep! It could be languages or another global variable issue. I used to set breakpoint in tp_ modules and print the mimemessage class. 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. Link to comment Share on other sites More sharing options...
piernas Posted September 26, 2016 Share Posted September 26, 2016 @@Gergely I'm testing this issue in depth. For now the error logs shows: With email templates active: [26-Sep-2016 04:00:46 Europe/Madrid] Invalid address: (addAnAddress Reply-To): "NAME" <[email protected]> [26-Sep-2016 04:00:46 Europe/Madrid] Invalid address: (punyEncode) "NAME" <[email protected]> [26-Sep-2016 04:00:46 Europe/Madrid] Invalid address: (addAnAddress to): "NAME" <[email protected]> [26-Sep-2016 04:00:46 Europe/Madrid] Invalid address: (addAnAddress Reply-To): "NAME" <[email protected]> Without email templates: [26-Sep-2016 04:23:44 Europe/Madrid] SERVER -> CLIENT: ***.***.com ESMTP Exim 4.87 #1 Sun, 25 Sep 2016 22:23:44 -0400 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. [26-Sep-2016 04:23:44 Europe/Madrid] CLIENT -> SERVER: EHLO domain.com [...] [26-Sep-2016 04:23:44 Europe/Madrid] SERVER -> CLIENT: 250 OK id=4boZe4-0005sR-20 [26-Sep-2016 04:23:44 Europe/Madrid] CLIENT -> SERVER: QUIT [26-Sep-2016 04:23:44 Europe/Madrid] SERVER -> CLIENT: 221 ***.***.*** closing connection [26-Sep-2016 04:23:44 Europe/Madrid] Invalid address: (addAnAddress to): "NAME" <[email protected]> Email is being sent without templates and only shows one of four errors (addAnAddress to) shown with templates active. Will dig to see where to set the breakpoint you mention and how templates work. I'm sure it's a silly thing that makes the email not being sent. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.