Hello Grav Community,
i ve setup a form using the form and email plugin. The content is serialized and sended by this:
$.ajax({
url: form.attr('action'),
type: form.attr('method'),
dataType: 'html',
data: form.serialize(),
success: function(result) {console.log('Message send.');},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
console.log("Status: " + textStatus);
console.log("Error: " + errorThrown);
}
});
The form definition looks like this:
title: footer
cache_enable: false
form:
name: kb-footer-form
action: /
id: kb-footer-form-id
classes: kb-footer-form
fields:
- name: Nachricht
placeholder: Geben Sie hier Ihre Nachricht ein.
type: textarea
rows: 7
buttons:
- type: submit
classes: kb-submit
value: ''
process:
- email:
from: "{{ config.plugins.email.from }}"
to:
- "{{ config.plugins.email.to }}"
subject: "[Website Kontakt]"
body: "{% include 'forms/data.txt.twig' %}"
reset: true
- save:
fileprefix: Website-Kontakt-
dateformat: Ymd-His-u
extension: txt
body: "{% include 'forms/data.txt.twig' %}"
If i had some linebreaks in a textarea, the email have hard coded CR LF in it and the content of a textarea looks like this:
Hello\r\nWorld!
Any clues?
Thanks in advance!
npetri