public function emailAction() { require_once Mage::getBaseDir('lib') . "/ElderXavier/socialnetworks/contact.php"; // Send mail require_once Mage::getBaseDir('lib') . "/ElderXavier/socialnetworks/emaimodell.php"; // Model mail message $sku = trim($_REQUEST['productid']); $product = Mage::getModel('catalog/product'); $id = Mage::getModel('catalog/product')->getResource()->getIdBySku($sku); if ($id) { $product->load($id); } $datathis = array(); $datathis['name'] = $_REQUEST["txtNomeId"]; $datathis['email'] = $_REQUEST["emaitxtlId"]; $datathis['message'] = $_REQUEST["txtMensagemId"]; $admin_email = $_REQUEST["emailAmigaId"]; // Send Email(s) $admin_email = str_replace(';', ',', $admin_email); $message_min_length = 5; // Min Message Length //$my_name = $datathis['name']; $friend_name = $_REQUEST["txtAmigaId"]; $product_name = $product->getName(); $product_brand = $product->getAttributeText('marca'); $product_image = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage(); $product_url = Mage::getBaseUrl() . $product->getData('url_path'); $message = $datathis['message']; $relational_cliente = '*****@*****.**'; $model_mail = new Email_Model($datathis['name'], $friend_name, $product_name, $product_brand, $product_image, $product_url, $message, $relational_cliente); $msg = $model_mail->printModel(); // model mail $datathis['message'] = $msg; //insert model; $contact_form = new Contact_Form($datathis, $admin_email, $message_min_length); $contact_form->sendRequest(); //send mail }
<?php $root = $_SERVER['DOCUMENT_ROOT']; require_once $root . '/models/back/Layout_Model.php'; require_once $root . '/models/back/Email_Model.php'; require_once $root . '/views/Layout_View.php'; require_once $root . '/backends/admin-backend.php'; require_once $root . '/Framework/Tools.php'; $email = new Email_Model(); // $memberId = (int) $_POST['memberId']; switch ($_POST['opt']) { case 1: if ($message = $email->getMessageByMessageId($_POST['message_id'])) { echo Layout_View::getViewMail($message); } else { echo '0'; } break; case 2: if ($tasks = $model->getTodayTasksByUser()) { echo Layout_View::listTasks($tasks); } else { ?> <div class="alert alert-dismissible alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Great! </strong> There are no tasks for today! </div> <?php } break; case 3:
if ($a['id']) { $id = str_replace(array('<', '>'), '', $a['id']); $search = "src=\"cid:" . $id . "\""; // change www.example.com etc to actual URL $replace = "src=\"" . $details['attachmentsDetail']['mboxdir'] . $a['name'] . "\""; // now do the replacements $details['body'] = str_replace($search, $replace, $details['body']); } } } } } $model->saveEmailMessages($details['messageId'], $details['udate'], $details['udate'], $details['fromAddr'], $account['email'], $details['fromName'], $details['subject'], $details['body'], $details['totalAttachments']); } } $emailModel = new Email_Model($branch); $countInbox = $emailModel->countInboxByEmailAccount($account['email_id']); $emailModel->setNumberOfInboxByAccount($account['email_id'], $countInbox); $countOutbox = $emailModel->countOutboxByEmailAccount($account['email_id']); $emailModel->setNumberOfOutboxByAccount($account['email_id'], $countOutbox); $countArchived = $emailModel->countArchivedByEmailAccount($account['email_id']); $emailModel->setNumberOfArchivedByAccount($account['email_id'], $countArchived); $email->close(); } $emailAccount = $account['email']; $info = ob_get_contents(); ob_end_clean(); echo '[ ' . date('H:i:s') . ' ] - ' . $info; $folder = dirname(__FILE__) . '/logs/email/' . $emailAccount; if (!file_exists($folder)) { mkdir($folder, 0777);