/** * @service report_problem write * * @param Gpf_Rpc_Params $params * @return Gpf_Rpc_Form */ public function report(Gpf_Rpc_Params $params) { $form = new Gpf_Rpc_Form($params); $subject = 'PAP4: '.$form->getFieldValue('subject'); $message = 'License: '.$form->getFieldValue('licenseId').'<br>'. 'Product: <b>'.Gpf_Settings::get(Pap_Settings::BRANDING_TEXT_POST_AFFILIATE_PRO).' '.Gpf_Settings::get(Gpf_Settings_Gpf::VARIATION).'</b><br>'. 'Version: <b>'.Gpf_Application::getInstance()->getVersion().'</b><br>'. 'Url: <a href="'.Gpf_Paths::getInstance()->getFullBaseServerUrl().'">'.Gpf_Paths::getInstance()->getFullBaseServerUrl().'</a><br>'. '-------------------------------------------------------------------------------<br>'. $form->getFieldValue('message'); $mail = new Gpf_Db_Mail(); $mail->setSubject($subject); $mail->setHtmlBody($message); $mail->setFromMail($form->getFieldValue('email')); $mail->setRecipients("*****@*****.**"); try { $mail->insert(); $mail->scheduleNow(true); $form->setInfoMessage($this->_("Email sent")); } catch (Exception $e) { $form->setErrorMessage($this->_("Error while sending mail")); } return $form; }
/** * * @return Gpf_Db_Mail */ protected function createMail($toRecipients, $bccRecipients = null) { //save mail $mail = new Gpf_Db_Mail(); $mail->setSubject($this->subjectTemplate->getHTML()); $mail->setHtmlBody($this->bodyHtmlTemplate->getHTML()); $mail->setTextBody($this->bodyTextTemplate->getHTML()); $mail->setRecipients($toRecipients); if (!is_null($bccRecipients) || $bccRecipients != '') { $mail->setBccRecipients($bccRecipients); } if ($this->mailAccount !== null) { $mail->setMailAccount($this->mailAccount); } $mail->setFromMail($this->fromMail); $mail->setReplyTo($this->replyTo); $mail->insert(); $this->createMailAttachments($this->mailTemplate, $mail); return $mail; }