1
rossb
oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/4 14:51

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Hi;
xoops 2.5.9, sme-server 9.2

I am attempting to update oledrion e-commerce to latest Paypal API and added functionality. Been stuck on sending purchase notification emails for over a week.

All other site emails working properly: registration, contact us...
email config (all blank except):
From user: xoops
Delivery Method: PHP Mail()
Path to sendmail: /usr/sbin/sendmail

class/mail/phpmailer/class.phpmailer.php::postSend() stuck in infinite retry loop
modified (for debug info) code:
...
public function postSend()
    {
        try {
            
// Choose the mailer and send through it
            //file_put_contents(OLEDRION_GATEWAY_LOG_PATH, "postsend1, method: " . $this->Mailer . "n", FILE_APPEND | LOCK_EX);
            
file_put_contents(OLEDRION_GATEWAY_LOG_PATH"." FILE_APPEND LOCK_EX);
            switch (
$this->Mailer) {
                case 
'sendmail':
                case 
'qmail':
                    return 
$this->sendmailSend($this->MIMEHeader$this->MIMEBody);
                case 
'smtp':
                    return 
$this->smtpSend($this->MIMEHeader$this->MIMEBody);
                case 
'mail':
                    return 
$this->mailSend($this->MIMEHeader$this->MIMEBody);
                default:
                    
$sendMethod $this->Mailer.'Send';
                    if (
method_exists($this$sendMethod)) {
                        return 
$this->$sendMethod($this->MIMEHeader$this->MIMEBody);
                    }

                    return 
$this->mailSend($this->MIMEHeader$this->MIMEBody);
            }
        } catch (
phpmailerException $exc) {
            
file_put_contents(OLEDRION_GATEWAY_LOG_PATH"postsend2, error: " $exc->getMessage() . "n"FILE_APPEND LOCK_EX);
            
$this->setError($exc->getMessage());
            
$this->edebug($exc->getMessage());
            if (
$this->exceptions) {
                throw 
$exc;
            }
        }
        return 
false;
    }

```
What I am seeing:
- Many "." in logfile, one per try attempt
- No catch exception (no entry in logfile)
- My mail send function never returns
- No record of "retry" email attempts in system logs
- No errors reported

My best "guess" as to what is happening is the email contents are template generated and not to mail's liking.

example email template input:
msg: Array
(
    [
COMMANDE] => 6     SecureOffice              Donate        1          $10.00


Total 
$10.00

    
[NUM_COMMANDE] => 252
    
[NOM] => Ross
    
[PRENOM] =>
    [
ADRESSE] =>
    [
CP] => noe1l0
    
[VILLE] => Oakland
    
[PAYS] => United States
    
[TELEPHONE] =>
    [
EMAIL] => ****private
    [
URL_BILL] => https://www.ayz.org/modules/oledrion/invoice.php?id=252&pass=****private
    
[IP] => 192.168.1.27
    
[FACTURE] => Yes
    
[TRANSACTION_ID] => 72K6104879318750E
)


This is way beyond my skill set. Failed try lacking exception. Need help.

Thanks;
Bill

2
zyspec
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/5 16:40

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


@Bill,

I don't know much about this module, and I just did a quick code read, but I'll ask a couple of questions that hopefully will lead you in the right direction....

* Which version of Oledrion are you using? (e.g. where did you get it?).

* In the code on Github. It looks to me like the call to the Utility::sendEmailFromTpl() method has been commented out (line 688) in the checkout routine (./checkout.php). I assume you've uncommented that code to see if it works?

3
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/5 17:24

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Hi Zyspec;

THANKs for your interest

I am using oledrion-2.35_RC1
latest, for xoops-2.5.10 :https://github.com/XoopsModules25x/oledrion
https://github.com/XoopsModules25x/oledrion
have hacked xoops_version.php for 2.5.9: "$modversion['min_xoops'] = '2.5.9';"
...since I see no 2.5.9 incompatibilities

Am attempting to fix / update oledrion for the community. CMS without working e-commerce module? Sad state of affairs.

If you want to go beyond code inspection, I will have to update you, since there are class naming and other errors in RC1.

re: * In the code on Github. It looks to me like the call to the Utility::sendEmailFromTpl() method has been commented out (line 688) in the checkout routine (./checkout.php). I assume you've uncommented that code to see if it works?

no, that code has been moved to modules/oledrion/class/Gateways/Paypal/PaypalGateway.php to send confirmation emails AFTER Paypal verify (made ZERO sense to confirm an order before paid for), part or changes mamba and I made for RC1. Since then (in addition to email issues), Paypal session dynamics have changed, breaking things.

Meanwhile, I am going deeper down rabbit hole, with debug statements to establish what's failing. Ignorance re low level email algorithms IS my problem.

Regards;
Bill

4
zyspec
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/6 17:00

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


@rossb,

I wouldn't mind helping but I'm currently working on 3 other modules trying to get them updated and working so I won't have any 'excess' time for a while.

If you put the current code on github then you might be able to find someone who can look at what you have to help. It's a little harder to collaborate otherwise.

Good luck and let us know how it's going.

5
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/6 20:35

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


thanks anyway. Need to finish cleanup and testing added features first. Once I get it to point where email is only issue, will consider publishing.

That doesn't mean, If a collaborator volunteers, that I am not prepared to immediately collaborate.
Oledrion is also in need of theming, by someone more competent than I.

...B

6
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/7 16:56

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Found a workaround. May be xoops-2.5.9 bug

/class/mail/phpmailer/class.phpmailer.php, alter function (comment stuff):

public function postSend()
    {
        try {
            
// Choose the mailer and send through it
            
switch ($this->Mailer) {
                case 
'sendmail':
                case 
'qmail':
                    return 
$this->sendmailSend($this->MIMEHeader$this->MIMEBody);
                case 
'smtp':
                    return 
$this->smtpSend($this->MIMEHeader$this->MIMEBody);
                case 
'mail':
                    return 
$this->mailSend($this->MIMEHeader$this->MIMEBody);
                default:
                    
//$sendMethod = $this->Mailer.'Send';
                    //if (method_exists($this, $sendMethod)) {
                    //    return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
                    //}
                    //file_put_contents(OLEDRION_GATEWAY_LOG_PATH, "!" , FILE_APPEND | LOCK_EX);
                    
return $this->mailSend($this->MIMEHeader$this->MIMEBody);
            }
        } catch (
phpmailerException $exc) {
            
$this->setError($exc->getMessage());
            
$this->edebug($exc->getMessage());
            if (
$this->exceptions) {
                throw 
$exc;
            }
        }
        return 
false;
    }



since
$this->$sendMethod($this->MIMEHeader$this->MIMEBody);

does not return, causes exception with no error text.

...B

7
Mamba
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/8 4:21

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Bill,
for code, please use

[ code]
your code here
[/code]

instead of

```
your code here
```

There is a button for it: < />

If you do it manually, please remove the space after the [
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

8
Mamba
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/9 0:20

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Please keep up posted on your progress.

I don't think, I'll have the time to dive into Oledrion before Christmas, but maybe somebody else could help....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

9
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/9 13:32

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


figured out you're really busy - not rocket science.

when you do get around to oledrion, hopefully only tasks remaining:
- code review my RC2 changes - will send U patches
- theming needs serious work

...B

10
Yurdal
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/9 18:35

  • Yurdal

  • Friend of XOOPS

  • Posts: 386

  • Since: 2005/3/27


@rossb
Really good work, someone has to give this modules a new live, as now most of the modules are not godd or not functioning any more
I'm afraid I cant help with code but if there any need to test environment I can help

Login

Who's Online

230 user(s) are online (64 user(s) are browsing Support Forums)


Members: 0


Guests: 230


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits