Exemplo n.º 1
0
 public function handle(MandrillMail $mailer)
 {
     $template = email_template('new_customer', $this->locale);
     $html_content = nl2br($template['body']);
     $html_content = str_replace('{password}', $this->customer->tmp_password, $html_content);
     $html_content = str_replace('{url}', config('app.url'), $html_content);
     $message = ['subject' => $template['subject'], 'inline_css' => true, 'merge' => true, 'merge_language' => 'handlebars', 'preserve_recipients' => false, 'global_merge_vars' => array(['name' => 'maincontent', 'content' => $html_content])];
     $message['to'] = [['email' => $this->customer->email, 'type' => 'to']];
     $mandrill_response = MandrillMail::messages()->sendTemplate('misc', '', $message);
 }
Exemplo n.º 2
0
/**
 * Send Email, DOES NOT SANITIZE FOR YOU!
 *
 * @since 1.0
 * @uses GSFROMEMAIL
 * @uses $EMAIL
 *
 * @param string $to
 * @param string $subject
 * @param string $message
 * @return string
 */
function sendmail($to, $subject, $message)
{
    $message = email_template($message);
    if (getDef('GSFROMEMAIL')) {
        $fromemail = GSFROMEMAIL;
    } else {
        if (!empty($_SERVER['SERVER_ADMIN']) && check_email_address($_SERVER['SERVER_ADMIN'])) {
            $fromemail = $_SERVER['SERVER_ADMIN'];
        } else {
            $fromemail = 'noreply@' . $_SERVER['SERVER_NAME'];
        }
    }
    global $EMAIL;
    $headers = '"MIME-Version: 1.0' . PHP_EOL;
    $headers .= 'Content-Type: text/html; charset=UTF-8' . PHP_EOL;
    $headers .= 'From: ' . $fromemail . PHP_EOL;
    $headers .= 'Reply-To: ' . $fromemail . PHP_EOL;
    $headers .= 'Return-Path: ' . $fromemail . PHP_EOL;
    return @mail($to, '=?UTF-8?B?' . base64_encode($subject) . '?=', "{$message}", $headers);
}
Exemplo n.º 3
0
/**
 * Send Email
 *
 * @since 1.0
 * @uses GSFROMEMAIL
 * @uses $EMAIL
 *
 * @param string $to
 * @param string $subject
 * @param string $message
 * @return string
 */
function sendmail($to, $subject, $message)
{
    $message = email_template($message);
    if (defined('GSFROMEMAIL')) {
        $fromemail = GSFROMEMAIL;
    } else {
        $fromemail = '*****@*****.**';
    }
    global $EMAIL;
    $headers = '"MIME-Version: 1.0' . PHP_EOL;
    $headers .= 'Content-Type: text/html; charset=UTF-8' . PHP_EOL;
    $headers .= 'From: ' . $fromemail . PHP_EOL;
    $headers .= 'Reply-To: ' . $fromemail . PHP_EOL;
    $headers .= 'Return-Path: ' . $fromemail . PHP_EOL;
    if (mail($to, '=?UTF-8?B?' . base64_encode($subject) . '?=', "{$message}", $headers)) {
        return 'success';
    } else {
        return 'error';
    }
}
Exemplo n.º 4
0
 public function handle(MandrillMail $mailer, OrderRepository $repository, CountryRepository $country)
 {
     $payment_kind_slugs = config('shop.payment_kind_slugs');
     $payment_kind_slug = $payment_kind_slugs[$this->order->payment_kind_id];
     $countries = $country->getList();
     $template = email_template('order_confirmation', config('app.locale'));
     $subject = str_replace('{order-number}', $this->order->order_number, $template['subject']);
     $body = markdown_text($template['body']);
     $body = str_replace('{name}', $this->order->invoice_first_name . ' ' . $this->order->invoice_last_name, $body);
     $body = str_replace('{order-number}', $this->order->order_number, $body);
     $order_details = '';
     $total = 0;
     if ($this->order->order_products) {
         foreach ($this->order->order_products as $order_product) {
             $complete_price = $order_product->quantity * $order_product->price_brut;
             $total += $complete_price;
             $order_details .= $order_product->quantity . " x " . $order_product->product_collection . " // " . $order_product->product_variant . " // " . $order_product->product_color . "\r" . trans('order.single_price') . ": " . convert_from_cents($order_product->price_brut) . " € // " . trans("shop.complete_price") . ": " . convert_from_cents($complete_price) . " €<hr>";
         }
     }
     $order_details .= trans('shop.price_sum') . ": " . convert_from_cents($total) . " €<hr>";
     $order_details .= trans('shop.shipping_costs') . ": " . convert_from_cents(config('shop.default_shipping_cost')) . " €<hr>";
     $order_details .= "<strong>" . trans('shop.total') . ": " . convert_from_cents(config('shop.default_shipping_cost') + $total) . " €</strong><hr><br><br>";
     $order_details .= trans('checkout.remarks') . ":<br>" . nl2br($this->order->remarks) . "<br><br>";
     if ($this->mode == 'self') {
         if ($this->order->paypal_transaction_id) {
             $order_details .= $this->order->paypal_transaction_id . "<br>";
         }
         if ($this->order->stripe_token_id) {
             $order_details .= $this->order->stripe_token_id . "<br>";
         }
     }
     $order_details .= trans('order.order_number') . ": " . $this->order->order_number . "<br>";
     $order_details .= trans('shop.payment_kind') . ": " . $this->order->payment_kind->name . "<br><br>";
     $body .= $order_details;
     $email_description = str_replace('{total}', convert_from_cents(config('shop.default_shipping_cost') + $total) . ' €', $this->order->payment_kind->email_description);
     $email_description = str_replace('{order-number}', $this->order->order_number, $email_description);
     $payment_details = $email_description . "<br><br>";
     if ($payment_kind_slug == 'prepayment') {
         $payment_details .= markdown_settings('bank_account') . "<br><br>";
     }
     $body .= $payment_details;
     $account_details = trans('shop.invoice_address') . ":<br>" . $this->order->invoice_first_name . " " . $this->order->invoice_last_name . "<br>";
     $account_details .= $this->order->invoice_street . "<br>" . $this->order->invoice_zip . " " . $this->order->invoice_city . "<br>";
     $account_details .= $countries[$this->order->invoice_country_id] . "<br><br>";
     $account_details .= trans('shop.shipping_address') . ":<br>" . $this->order->shipping_first_name . " " . $this->order->shipping_last_name . "<br>";
     $account_details .= $this->order->shipping_street . "<br>" . $this->order->shipping_zip . " " . $this->order->shipping_city . "<br>";
     $account_details .= $countries[$this->order->shipping_country_id] . "<br><br>";
     $body .= $account_details;
     if ($this->mode != 'self') {
         $legal = "";
         $legal .= "<br><br><div class='small'><em>" . trans('order.right_of_withdrawal_note') . "</em><br>";
         $legal .= markdown_settings('right_of_withdrawal');
         $legal .= "<br><em>" . trans('order.end_of_right_of_withdrawal_note') . "</em></div><br><br>";
         $body .= $legal;
         /*
         $terms = "";
         $terms .= "<br><br><div class='small'>";
         $terms .= markdown_settings('terms');
         $terms .= "</div><br><br>";
         $body .= $terms;
         */
     }
     $html_content = $body;
     $to_emails = [$this->order->invoice_email];
     if ($this->mode == 'self') {
         $to_emails = explode(',', settings('order_email_addresses'));
     }
     foreach ($to_emails as $to_email) {
         $message = ['subject' => $subject, 'inline_css' => true, 'merge' => true, 'merge_language' => 'handlebars', 'preserve_recipients' => false, 'global_merge_vars' => array(['name' => 'maincontent', 'content' => $html_content])];
         $message['to'] = [['email' => $to_email, 'type' => 'to']];
         $mandrill_responses = MandrillMail::messages()->sendTemplate('order-confirmation', '', $message);
     }
 }