getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

Messages come without attachments #115

Closed k1ll1n closed 1 year ago

k1ll1n commented 5 years ago

I did the following - actions! Installed Grav from Github Installed email plugin from Github Installed forms plugin from Github

I included the form to the template Quark {% include 'forms/form.html.twig' %}

My blueprint

forms:
    feedback_form:
        method: POST
        fields:
            -
                name: name
                type: text
                validate:
                    required: true
            -
                name: tel
                type: text
                validate:
                    required: true
            -
                name: email
                type: text
                validate:
                    rule: email
                    required: true
            -   
                name: brief
                type: file
                multiple: false
                destination: 'user/data/files'
                accept: 
                    - '*'
        buttons:
            -
               type: submit
               value: 'Оставить заявку'
               classes: submit
        process:
            -
               email:
                   from: '{{ config.plugins.email.from }}'
                   to:
                       - '{{ config.plugins.email.to }}'
                   subject: '[Feedback] {{ form.value.name|e }}'
                   body: '{% include ''forms/data.html.twig'' %}'
                   attachments:
                       - 'brief'
            -
               save:
                   fileprefix: feedback-
                   dateformat: Ymd-His-u
                   extension: txt
                   body: '{% include ''forms/data.txt.twig'' %}' 

My Settings for Email Plugin

enabled: true
from: dev-user@3832456.ru
from_name: 'Dev User'
to: subikrus@gmail.com
to_name: Alex
queue:
  enabled: false
  flush_frequency: '* * * * *'
  flush_msg_limit: 10
  flush_time_limit: 100
mailer:
  engine: smtp
  smtp:
    server: smtp.yandex.ru
    port: 465
    encryption: ssl
    user: login@domain.ru
    password: password
  sendmail:
    bin: '/usr/sbin/sendmail -bs'
content_type: text/html
debug: true

But messages still come without attachments As well as grav does not create a folder for attachments user/data/files

Grav v1.6.9 Email v3.0.2 Form v3.0.3

mahagr commented 5 years ago

Could you please add paths to the files you added/edited with the full content?

k1ll1n commented 5 years ago

.1 /var/www/grav-test.dev/user/themes/quark/templates/base.html.twig 1.1.

{% set body_classes = body_class(['header-fixed', 'header-animated', 'header-dark', 'header-transparent', 'sticky-footer']) %}
{% set grid_size = theme_var('grid-size') %}
{% set compress = theme_var('production-mode') ? '.min.css' : '.css' %}
<!DOCTYPE html>
<html lang="{{ grav.language.getActive ?: grav.config.site.default_lang }}">
<head>
{% block head deferred %}
    <meta charset="utf-8" />
    <title>{% if page.title %}{{ page.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {% include 'partials/metadata.html.twig' %}

    <link rel="icon" type="image/png" href="{{ url('theme://images/favicon.png') }}" />
    <link rel="canonical" href="{{ page.url(true, true) }}" />
{% endblock head %}

{% block stylesheets %}
    {% do assets.addCss('theme://css-compiled/spectre'~compress) %}
    {% if theme_var('spectre.exp') %}{% do assets.addCss('theme://css-compiled/spectre-exp'~compress)  %}{% endif %}
    {% if theme_var('spectre.icons') %}{%  do assets.addCss('theme://css-compiled/spectre-icons'~compress) %}{% endif %}
    {% do assets.addCss('theme://css-compiled/theme'~compress) %}
    {% do assets.addCss('theme://css/custom.css') %}
    {% do assets.addCss('theme://css/line-awesome.min.css') %}
{% endblock %}

{% block javascripts %}
    {% do assets.addJs('jquery', 101) %}
    {% do assets.addJs('theme://js/jquery.treemenu.js', {group:'bottom'}) %}
    {% do assets.addJs('theme://js/site.js', {group:'bottom'}) %}
{% endblock %}

{% block assets deferred %}
    {{ assets.css()|raw }}
    {{ assets.js()|raw }}
{% endblock %}
</head>
<body id="top" class="{% block body_classes %}{{ body_classes }}{% endblock %}">

    <div id="page-wrapper">
    {% block header deferred %}
        <section id="header" class="section">
            <section class="container {{ grid_size }}">
                <nav class="navbar">
                    <section class="navbar-section logo">
                        {% include 'partials/logo.html.twig' %}
                    </section>
                    <section class="navbar-section desktop-menu">

                        <nav class="dropmenu animated">
                        {% block header_navigation %}
                            {% include 'partials/navigation.html.twig' %}
                        {% endblock %}
                        </nav>

                        {% if config.plugins.login.enabled and grav.user.username %}
                            <span class="login-status-wrapper"><i class="fa fa-user"></i> {% include 'partials/login-status.html.twig' %}</span>
                        {% endif %}

                    </section>
                </nav>
            </section>
        </section>
        <div class="mobile-menu">
            <div class="button_container" id="toggle">
                <span class="top"></span>
                <span class="middle"></span>
                <span class="bottom"></span>
            </div>
        </div>
    {% endblock %}

    {% block hero %}{% endblock %}

        <section id="start">
        {% block body %}
            <section id="body-wrapper" class="section">
                <section class="container {{ grid_size }}">
                    {% block messages %}
                        {% include 'partials/messages.html.twig' ignore missing %}
                    {% endblock %}
                    {% block content %}{% endblock %}
                </section>
            </section>
        {% endblock %}
        </section>

    </div>

    {% include 'forms/form.html.twig' %}

    {% block footer %}
        {% include 'partials/footer.html.twig' %}
    {% endblock %}

    <div class="mobile-container">
        <div class="overlay" id="overlay">
            <div class="mobile-logo">
                {% include 'partials/logo.html.twig' with {mobile: true} %}
            </div>
            <nav class="overlay-menu">
                {% include 'partials/navigation.html.twig' with {tree: true} %}
            </nav>
        </div>
    </div>

{% block bottom %}
    {{ assets.js('bottom')|raw }}
{% endblock %}

</body>
</html>

.2 /var/www/grav-test.dev/user/pages/default.md 2.1.

---
title: Home
body_classes: title-center title-h1h2
forms:
    feedback_form:
        method: POST
        fields:
            -
                name: name
                type: text
                validate:
                    required: true
            -
                name: tel
                type: text
                validate:
                    required: true
            -
                name: email
                type: text
                validate:
                    rule: email
                    required: true
            -   
                name: brief
                type: file
                multiple: false
                destination: user/data/files
                accept: 
                    - '*'
        buttons:
            -
               type: submit
               value: 'Оставить заявку'
               classes: submit
        process:
            -
               email:
                   from: '{{ config.plugins.email.from }}'
                   to:
                       - '{{ config.plugins.email.to }}'
                   subject: '[Feedback] {{ form.value.name|e }}'
                   body: '{% include ''forms/data.html.twig'' %}'
                   attachments:
                       - 'brief'
            -
               save:
                   fileprefix: feedback-
                   dateformat: Ymd-His-u
                   extension: txt
                   body: '{% include ''forms/data.txt.twig'' %}'  
---

# Say Hello to Grav!
## installation successful...

Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started.

!! If you see a **404 Error** when you click `Typography` in the menu, please refer to the [troubleshooting guide](http://learn.getgrav.org/troubleshooting/page-not-found).

### Find out all about Grav

* Learn about **Grav** by checking out our dedicated [Learn Grav](http://learn.getgrav.org) site.
* Download **plugins**, **themes**, as well as other Grav **skeleton** packages from the [Grav Downloads](http://getgrav.org/downloads) page.
* Check out our [Grav Development Blog](http://getgrav.org/blog) to find out the latest goings on in the Grav-verse.

!!! If you want a more **full-featured** base install, you should check out [**Skeleton** packages available in the downloads](http://getgrav.org/downloads).

### Edit this Page

To edit this page, simply navigate to the folder you installed **Grav** into, and then browse to the `user/pages/01.home` folder and open the `default.md` file in your [editor of choice](http://learn.getgrav.org/basics/requirements).  You will see the content of this page in [Markdown format](http://learn.getgrav.org/content/markdown).

### Create a New Page

Creating a new page is a simple affair in **Grav**.  Simply follow these simple steps:

1. Navigate to your pages folder: `user/pages/` and create a new folder.  In this example, we will use [explicit default ordering](http://learn.getgrav.org/content/content-pages) and call the folder `03.mypage`.
2. Launch your text editor and paste in the following sample code:

        ---
        title: My New Page
        ---
        # My New Page!

        This is the body of **my new page** and I can easily use _Markdown_ syntax here.

3. Save this file in the `user/pages/03.mypage/` folder as `default.md`. This will tell **Grav** to render the page using the **default** template.
4. That is it! Reload your browser to see your new page in the menu.

! NOTE: The page will automatically show up in the Menu after the "Typography" menu item. If you wish to change the name that shows up in the Menu, simple add: `menu: My Page` between the dashes in the page content. This is called the YAML front matter, and it is where you configure page-specific options.

I can upload the entire project in the archive.