/** * * @param $outboxid * @return Gpf_Db_Mail */ private function loadMailFromOutbox($outboxid) { $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Gpf_Db_Table_Mails::getInstance(), 'm'); $select->from->add(Gpf_Db_Table_MailOutbox::getName(), 'mo'); $select->from->addInnerJoin(Gpf_Db_Table_Mails::getName(), 'm', 'm.' . Gpf_Db_Table_Mails::ID . ' = mo.' . Gpf_Db_Table_MailOutbox::MAIL_ID); $select->where->add("mo." . Gpf_Db_Table_MailOutbox::ID, "=", $outboxid); $mail = new Gpf_Db_Mail(); $mail->fillFromSelect($select); return $mail; }
/** * @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; }
/** * Mark outbox entry as ready * * @param Gpf_Data_Record $mail */ private function finishSending(Gpf_Data_Record $mail) { $outbox = new Gpf_Db_MailOutbox(); $outbox->set('outboxid', $mail->get('outboxid')); $outbox->set('status', Gpf_Db_Table_MailOutbox::STATUS_READY); $outbox->update(array('status')); $mailObj = new Gpf_Db_Mail(); $mailObj->set('mailid', $mail->get('mailid')); $mailObj->set('delivered', $this->createDatabase()->getDateString()); $mailObj->update(array('delivered')); }
protected function createMailAttachments(Gpf_Db_MailTemplate $template, Gpf_Db_Mail $mail) { $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->add('fileid', 'fileid'); $select->select->addConstant($mail->get('mailid'), 'mailid'); $select->select->add('is_included_image', 'is_included_image'); $select->from->add(Gpf_Db_Table_MailTemplateAttachments::getName()); $select->where->add('templateid', '=', $template->get('templateid')); $insert = new Gpf_SqlBuilder_InsertBuilder(); $insert->setTable(Gpf_Db_Table_MailAttachments::getInstance()); $insert->fromSelect($select); $insert->execute(); }
public function execute() { $mail = new Gpf_Db_Mail(); $mailAccount = $mail->getMailAccount(); Gpf_Settings::set(Pap_Settings::MERCHANT_NOTIFICATION_EMAIL, $mailAccount->getAccountEmail()); }
/** * Load default mail account * * @return Gpf_Db_MailAccount */ private function loadDefaultMailAccount() { if (self::$defaultMailAccount === null) { $mailAccountsTable = Gpf_Db_Table_MailAccounts::getInstance(); self::$defaultMailAccount = $mailAccountsTable->getDefaultMailAccount(); } return self::$defaultMailAccount; }