View Issue Details

IDProjectCategoryView StatusLast Update
0005085OXID eShop (all versions)4.07. Source code, Testpublic2022-02-01 08:33
Reportervanilla thunder Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.7.4 / 5.0.4 revision 57063 
Fixed in Version6.0.0 
Summary0005085: adding attachments to order email for customer does not work
Descriptionadding any kind of attachments does not work in order email for customer.
There are no php/smarty errors or exceptions. Email arrives but without attachments. Order email for shop owner is OK.
Steps To Reproduceget the attached module or add function
$this->addAttachment($sPath);
to oxEmail->sendOrderEMailToUser() or oxEmail->_addUserInfoOrderEMail()
Last one is used in both emails for shop owner and customer, so you will see the code actually working.
Additional Informationworked earlier with ce/pe 4.4 & 4.5 & 4.6
tested on 4.7.2, 4.7.3 and 4.7.4 ce/pe
TagsEmail
Attached Files
emailattachment.zip (82,231 bytes)
ThemeNot defined
BrowserAll
PHP Version5.3
Database VersionNot defined

Relationships

related to 0004975 resolvedSvenBrunk Improve oxemail class methods 
related to 0006314 acknowledgedSvenBrunk Non endoded "Umlauts" in Email not working 

Activities

Linas Kukulskis

2013-04-29 15:06

reporter   ~0008642

This case is related with your own shop configuration etc. if you have problems with extending shop functionality with modules please contact our support: [email protected]

vanilla thunder

2013-04-29 17:16

reporter   ~0008644

Last edited: 2013-04-29 17:17

I really do not want to be discourteous,
but its almost impossible to properly extend sendOrderEmailToUser() because:
-> it sends the email at the end of the function, so i have to run my code before the original code,
-> just at the beginning the function calls $this->_setMailParams($oShop), which resets all params and attachments of the email made before.

And now the reason why i still suppose this being a bug and not a configuration problem:
"sendOrderEmailToUser()" calls "_addUserInfoOrderEMail()" right before "_setMailParams()", so "_setMailParams()" would reset all settings set by "_addUserInfoOrderEMail()", which makes no sense for me.
And know, that "_addUserInfoOrderEMail()" contains no settings, but "sendOrderEmailToOwner()" calls "_addUserInfoOrderEMail()" after resetting settings.
And finally i haven't found any setting could prevent resetting email params and attachments.

Linas Kukulskis

2013-04-30 08:06

reporter   ~0008645

yes, design of this class not perfect. we suggest to rewrite sendOrderEmailToUser() in your module and we from our side as the fix will improve the design of the class.

FibreFoX

2013-04-30 10:20

reporter   ~0008646

If you want to improve the design, maybe you want upgrade PHPMailer too? ;)
Ticket: https://bugs.oxid-esales.com/view.php?id=4200

FibreFoX

2014-04-17 10:52

reporter   ~0009846

one of the main problems is that oxemail is overriding PHPMailer-methods without having the ability to access them.

this is what i used to put my own attachements to the order-mail (i tried to disable the clean method when i have to):


    const skipFlag = "skipClearAttachments";
    
    public function sendOrderEmailToUser( $oOrder, $sSubject = null ){
        $modifiedOrder = $this->addMySpecialFiles($oOrder);
        oxRegistry::getSession()->setVariable(self::skipFlag, true);
        $parentResult = parent::sendOrderEmailToUser($modifiedOrder, $sSubject);
        oxRegistry::getSession()->deleteVariable(self::skipFlag);
        return $parentResult;
    }

    // workaround for not deleting special attachments
    public function clearAttachments(){
        // clear oxid-attachments
        $this->_aAttachments = array();
        if( oxRegistry::getSession()->getVariable(self::skipFlag) === true ){
            // dont clear oxid- and phpmailer-attachments
            return;
        }
        return parent::clearAttachments();
    }

SvenBrunk

2022-02-01 08:33

administrator   ~0013628

The Email class has been refactored with v6.0.0 so it should now be a lot easier to overwrite it.
Regarding the PHPMailer upgrade: We do this on a regular basis. oxideshop_ce in Version 6.10 uses PHPMailer 6.5