Пример #1
0
function sendContactMail($name, $email, $website, $message, $config)
{
    $_body = $message;
    if ($website) {
        $_body .= "<br /><br />{$website}";
    }
    if ($config['live']) {
        $body = file_get_contents(BASE_URI . DS . 'views' . DS . 'mail_template.html');
        $body = str_replace('{{title}}', 'Message from ' . $name . ' to WildVapor Inc', $body);
        $body = str_replace('{{message}}', $_body, $body);
        $data = array('live' => $config['live'], 'mail_server' => $config['mail_server'], 'mail_port' => $config['mail_port'], 'mail_username' => $config['mail_username'], 'mail_password' => $config['mail_password'], 'mail_to_address' => $config['mail_from'], 'mail_to_name' => 'Wildvapor', 'subject' => "Mail from {$name}", 'body' => $body, 'mail_from' => $email);
        $mailer = new \Helpers\Mailer($data);
        if ($mailer->sendMail()) {
            return 'Your message has been sent. Thank you.';
        } else {
            return array('error' => $mailer->getError());
        }
    } else {
        return $body;
    }
}
Пример #2
0
 /**
  * Отправляет копию письма на адрес из поля email
  * @return mixed
  */
 public function sendCCSender()
 {
     $to = $this->getField($this->getCFGDef('ccSenderField', 'email'));
     if (!empty($to) && $this->getCFGDef('ccSender', 0)) {
         $mailer = new \Helpers\Mailer($this->modx, array_merge($this->mailConfig, array('subject' => $this->renderSubject(), 'to' => $to, 'fromName' => $this->getCFGDef('ccSenderFromName', $this->modx->config['site_name']))));
         $report = $this->renderReport('ccSenderTpl');
         $out = $mailer->send($report);
         $this->log('Mail CC report', array('report' => $report, 'mailer_config' => $mailer->config, 'result' => $out));
         return $out;
     }
 }
Пример #3
0
 public function send_direct_payment_mails($order_id, $cart, $data)
 {
     if ($this->config['live']) {
         $mails = array('customer' => array(), 'merchant' => array());
         $mails['customer']['body'] = "Thank you for your order. Your order number is {$order_id}. All orders are processed on the next business day. You will be contacted in case of any delays.";
         $mails['merchant']['body'] = 'New Order. The order number is ' . $order_id;
         $mails['customer']['body'] .= '<br />Payment Received! Your product will be sent to you very soon! Thank you for buying.';
         $mails['merchant']['body'] .= '<br />Payment Received! Your really need to send the products.';
         $mails['merchant']['body'] .= '<br /><br /><h2>CART DATA</h2>';
         foreach ($cart['cart_items'] as $row) {
             $mails['merchant']['body'] .= '<br />' . $row['quantity'] . ' X ' . $row['name'];
         }
         $mails['merchant']['body'] .= '<br /><br /><strong>Total Price: </strong>' . number_format($cart['total'], 2);
         $mails['merchant']['body'] .= '<br /><br /><h2>Customer Data</h2>';
         $mails['merchant']['body'] .= '<br /><strong>First Name: </strong>' . $data['first_name'];
         $mails['merchant']['body'] .= '<br /><strong>Last Name: </strong>' . $data['last_name'];
         $mails['merchant']['body'] .= '<br /><strong>Email Address: </strong>' . $data['email'];
         $mails['merchant']['body'] .= '<br /><strong>Phone Number: </strong>' . $data['phone'];
         $mails['merchant']['body'] .= '<br /><strong>Shipping Address1: </strong>' . $data['shipping_address1'];
         $mails['merchant']['body'] .= '<br /><strong>Shipping Address2: </strong>' . $data['shipping_address2'];
         $mails['merchant']['body'] .= '<br /><strong>Shipping City: </strong>' . $data['shipping_city'];
         $mails['merchant']['body'] .= '<br /><strong>Shipping State: </strong>' . $data['shipping_state'];
         $mails['merchant']['body'] .= '<br /><strong>Shipping Zip Code: </strong>' . $data['shipping_zip_code'];
         $mails['merchant']['body'] .= '<br /><strong>Billing Address1: </strong>' . $data['billing_address1'];
         $mails['merchant']['body'] .= '<br /><strong>Billing Address2: </strong>' . $data['billing_address2'];
         $mails['merchant']['body'] .= '<br /><strong>Billing City: </strong>' . $data['billing_city'];
         $mails['merchant']['body'] .= '<br /><strong>Billing State: </strong>' . $data['billing_state'];
         $mails['merchant']['body'] .= '<br /><strong>Billing Zip Code: </strong>' . $data['billing_zip_code'];
         $body = file_get_contents(BASE_URI . DS . 'views' . DS . 'mail_template.html');
         $body = str_replace('{{title}}', 'Order Confirmation at WildVapor Inc', $body);
         $body = str_replace('{{message}}', $mails['customer']['body'], $body);
         $data_customer = array('live' => $this->config['live'], 'mail_username' => $this->config['mail_username'], 'mail_password' => $this->config['mail_password'], 'mail_to_address' => $data['email'], 'mail_to_name' => $data['first_name'] . ' ' . $data['last_name'], 'subject' => 'Order confirmation at WildVapor Inc.', 'body' => $body, 'mail_from' => $this->config['mail_from']);
         $body = file_get_contents(BASE_URI . DS . 'views' . DS . 'mail_template.html');
         $body = str_replace('{{title}}', 'New Order at WildVapor Inc', $body);
         $body = str_replace('{{message}}', $mails['merchant']['body'], $body);
         $data_merchant = array('live' => $this->config['live'], 'mail_username' => $this->config['mail_username'], 'mail_password' => $this->config['mail_password'], 'mail_to_address' => $this->config['mail_from'], 'mail_to_name' => 'Marcos Escandell', 'subject' => 'New Order at WildVapor Inc.', 'body' => $body, 'mail_from' => $this->config['mail_from']);
         $m1 = new \Helpers\Mailer($data_customer);
         $m2 = new \Helpers\Mailer($data_merchant);
         if ($m1->sendMail() && $m2->sendMail()) {
             return true;
         } else {
             return array('error' => $m1->getError() . '\\n\\n' . $m2->getError());
         }
     } else {
         return true;
     }
 }
Пример #4
0
function sendForgotPasswordMail($user, $password, $config)
{
    $message = "Your password to log into WildVapor has been\n    temporarily changed to '{$password}'. Please log in using that password and this\n    email address. Then you may change your password to something more familiar.";
    if ($config['live']) {
        $body = file_get_contents(BASE_URI . DS . 'views' . DS . 'mail_template.html');
        $body = str_replace('{{title}}', 'Your temporary password at WildVapor Inc', $body);
        $body = str_replace('{{message}}', $message, $body);
        $data = array('live' => $config['live'], 'mail_username' => $config['mail_username'], 'mail_password' => $config['mail_password'], 'mail_to_address' => $user['email'], 'mail_to_name' => \Helpers\User::get_name($user), 'subject' => 'Your temporary password at WildVapor.', 'body' => $body, 'mail_from' => $config['mail_from']);
        $mailer = new \Helpers\Mailer($data);
        if ($mailer->sendMail()) {
            return 'Your password has been changed. You will receive
        the new, temporary password via email. Once you have logged in
        with this new password, you may change it by clicking on the "Change
        Password" link.';
        } else {
            return array('error' => $mailer->getError());
        }
    } else {
        return $message;
    }
}