Comments (12)
This is how it actually shows up in the error screen:
from grav-plugin-email.
If this provided contact.md
is using the same configuration file from you other issue, there was no value for {{ config.plugins.email.from }}
nor {{ config.plugins.email.to }}
. These were both empty. These need to be provided i a valid email format: https://github.com/getgrav/grav-plugin-email?tab=readme-ov-file#specifying-email-addresses
You said you use "Name lastname <[email protected])>" so I tested with:
process:
email:
subject: "[Site Contact Form] {{ form.value.name|e }}"
from: "Name lastname <[email protected]>"
to: "Name lastname <[email protected]>"
...
And it worked totally 100% fine. Even without the quotes its fine:
process:
email:
subject: "[Site Contact Form] {{ form.value.name|e }}"
from: Name lastname <[email protected]>
to: Name lastname <[email protected]>
FYI, you should always include a reply_to:
so when you receive an email from the contact form, you can click 'reply' and it will go to the user who entered the form data on your site. Something like:
reply_to: {mail:"{{ form.value.email }}", name:"{{ form.value.name|e }}"}
is the best solution assuming your form has a field for email
and for name
.
from grav-plugin-email.
Thanks for the reply_to tip. I implemented it and it works!
Here is my new email.yaml
enabled: true
from: 'John Doe <[email protected]>'
to: 'Jane Doe <[email protected]>'
mailer:
engine: sendgrid
smtp:
server: localhost
port: 25
encryption: none
user: null
password: null
sendmail:
bin: '/usr/sbin/sendmail -bs'
content_type: text/html
debug: false
cc: null
bcc: null
reply_to: null
body: null
Which throws the RFC error
Here is my contact.md which I know does not have any lines for "name:" not sure what I need to fix here so that emails are sent to 'Jane Doe [email protected]' and come from 'John Doe [email protected]'
title: Contact
heading: 'Say Hello.'
form:
action: /home
name: contact-form
fields:
-
name: name
label: Name
placeholder: Name
type: text
validate:
required: true
-
name: email
label: Email
placeholder: Email
type: email
validate:
required: true
-
name: message
label: Message
placeholder: Message
type: textarea
rows: 6
validate:
required: true
-
name: g-recaptcha-response
label: Captcha
type: captcha
recaptcha_not_validated: 'Captcha not valid!'
buttons:
-
type: submit
value: 'Send Message'
process:
-
captcha: true
buttons: null
-
type: submit
value: 'Send Message'
process: null
-
email:
from:
mail: '{{ config.plugins.email.from }}'
to:
mail: '{{ config.plugins.email.to }}'
reply_to:
mail: '{{ form.value.email }}'
name: '{{ form.value.name|e }}'
subject: '[Contact] Message from {{ form.value.name|e }}'
body: '{% include ''forms/data.html.twig'' %}'
-
save:
fileprefix: contact-
dateformat: Ymd-His-u
extension: txt
body: '{% include ''forms/data.txt.twig'' %}'
-
display: thank-you
from grav-plugin-email.
OH, change your email process: email:
section to:
-
email:
from: '{{ config.plugins.email.from }}'
to: '{{ config.plugins.email.to }}'
reply_to:
mail: '{{ form.value.email }}'
name: '{{ form.value.name|e }}'
subject: '[Contact] Message from {{ form.value.name|e }}'
body: '{% include ''forms/data.html.twig'' %}'
You were setting the 'email' only part (mail:
) with the combined email + name. Just set to:
and from:
and you should be fine.
from grav-plugin-email.
when I change the process: email:
section to your recommendation. I get:
Symfony\Component\Mime\Exception\RfcComplianceException thrown with message "Email "Jane Doe <[email protected]>" does not comply with addr-spec of RFC 2822."
I am assuming I have to add some kind of name
field, right?
I am following the the formating given in the email plugin interface:
from grav-plugin-email.
So you have quotes around it? Try removing. Maybe they are not regular quotes.
from grav-plugin-email.
So you have quotes around it? Try removing. Maybe they are not regular quotes.
No quotes
from grav-plugin-email.
I’m at a loss 🤷♂️
works for me when I try.
from grav-plugin-email.
The way it shows up on my screen is like this:
from grav-plugin-email.
Ya that’s weird. The escaping isn’t right. But I don’t even know how you could do that from a yaml configuration.
from grav-plugin-email.
The only way I get it to work is if my email.yaml looks like this:
enabled: true
from: '[email protected]'
to: '[email protected]'
mailer:
engine: sendgrid
smtp:
server: localhost
port: 25
encryption: none
user: null
password: null
sendmail:
bin: '/usr/sbin/sendmail -bs'
content_type: text/html
debug: false
cc: null
bcc: null
reply_to: null
body: null
from grav-plugin-email.
@rhukster so from what you wrote above, it sounds like when you add name and email address to the Email plugin fields like so:
Using:
email:
from: '{{ config.plugins.email.from }}'
to: '{{ config.plugins.email.to }}'
reply_to:
mail: '{{ form.value.email }}'
name: '{{ form.value.name|e }}'
subject: '[Contact] Message from {{ form.value.name|e }}'
body: '{% include ''forms/data.html.twig'' %}'
Your email is delivered coming from John Doe <[email protected]>
and is sent to Jane Doe ,<[email protected]>
in full
in full name-addr
format? is that what you mean by that you can't replicate this?
from grav-plugin-email.
Related Issues (20)
- PHP 8.1 support - update `swiftmailer`
- `swiftmailer/swiftmailer` is EOL HOT 5
- Message not sent if no user defined HOT 1
- Mailing through mailjet API fails silently when quota is exceeded HOT 2
- Verification of To and From email in the plugins's settings HOT 1
- Can't change/save SMTP configuration HOT 11
- mb_strpos() expects parameter 1 to be string, array given with test version v4.0.0-rc.3 HOT 4
- Change of Signature on email
- doesnt work HOT 2
- Undefined array key "bcc_name" HOT 4
- File Attachments in Version 4.0 onward HOT 3
- Issues with multiple recipients in recent versions (since 4.0 I believe) HOT 1
- Spam issue when modifiying from HOT 3
- "User is not set" error in recent versions HOT 6
- Server Error after update HOT 3
- Problem with sending email (encryption: none) HOT 1
- Call to undefined method Grav\Plugin\Email\Message::setCc() HOT 2
- Email sent to default "From" ignores default "to" HOT 2
- Default Plugin yaml issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grav-plugin-email.