Hey Leute,
ich habe ein kleines Thema bezüglich Mailversand via ERP-Connector.
Ich habe ein Plugin geschrieben und spreche dies via ERP-Connector an - aktuell über SOAP UI.
Innerhalb des Plugins rufe ich die Methode sendForgotPwdEmail wie folgt auf:
$oEmail = oxNew('oxemail');
$iSuccess = $oEmail->sendForgotPwdEmail($sEmail);
Der Mailer läuft jedoch auf Probleme, da der Body der Nachricht leer bleibt - er hat an der Stelle das Problem, dass er das Template (forgotpwd.tpl) nicht ausgelesen bekommt:
oxException (time: 2018-05-30 15:58:56): [0]: Message body empty
Stack Trace: #0 C:\xampp_PHP5\htdocs\vhosts\oxid5\core\oxutilsobject.php(180): oxUtilsObject->_getObject(‘oxexception’, 0, Array)
#1 [internal function]: oxUtilsObject->oxNew(‘oxException’)
#2 C:\xampp_PHP5\htdocs\vhosts\oxid5\core\oxfunctions.php(360): call_user_func_array(Array, Array)
#3 C:\xampp_PHP5\htdocs\vhosts\oxid5\core\oxemail.php(2046): oxNew(‘oxException’)
#4 C:\xampp_PHP5\htdocs\vhosts\oxid5\core\oxemail.php(407): oxEmail->_sendMail()
#5 C:\xampp_PHP5\htdocs\vhosts\oxid5\core\oxemail.php(771): oxEmail->send()
#6 C:\xampp_PHP5\htdocs\vhosts\oxid5\modules\erp\plugins\esysenduserregistrationemailplugin.php(82): oxEmail->sendForgotPwdEmail(‘admin@localhost…’)
#7 C:\xampp_PHP5\htdocs\vhosts\oxid5\modules\erp\plugins\esysenduserregistrationemailplugin.php(32): esysenduserregistrationemailplugin->sendUserRegirstrationEmail(‘68719477496’)
#8 C:\xampp_PHP5\htdocs\vhosts\oxid5\modules\erp\plugins\oxerppluginbase.php(46): esysenduserregistrationemailplugin->invoke(Array)
#9 C:\xampp_PHP5\htdocs\vhosts\oxid5\modules\erp\oxerpgateway.php(1860): oxErpPluginBase->invokeEntry(Array)
#10 [internal function]: oxERPGateway->OXERPCallPlugin(Object(stdClass))
#11 C:\xampp_PHP5\htdocs\vhosts\oxid5\modules\erp\oxerpservice.php(148): SoapServer->handle()
#12 {main}
Weiterhin muss ich in der oxemail / sendForgotPwdEmail
folgendenden Teil auskommentieren:
//$this->setAltBody($oSmarty->fetch($this->_sForgotPwdTemplatePlain));
Ist diese Zeile nicht auskommentiert, bekomme ich via SOAPUI folgende Meldung:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Call to a member function getRawValue() on null</faultstring>
<detail>Hallo</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Ändere ich
$this->setBody($oSmarty->fetch($this->_sForgotPwdTemplate));
$this->setAltBody($oSmarty->fetch($this->_sForgotPwdTemplatePlain));
zu:
$this->setBody("<b>Test</b>");
$this->setAltBody("Test");
so wird die Mail korrekt versendet. Er versucht auf die Template-Datei forgotpwd.tpl im smarty-Ordner zuzugreifen, jedoch liegt diese dort nicht vor.
Rufe ich die Funktion aus einem Modul heraus auf, so gelingt der Versand - daher vermute ich besondere Umstände im ERP-Connector.
Der Shop sowie Templates befinden sich im Standard.
Gibt es eine andere Möglichkeit die genannte EMail zu versenden?
Beste Grüße - Alex