Comments (5)
I think there is no way for this plugin to force a change of the header without using a new email service. A simple change of the default mail
service would make this possible:
email::$services['html-mail'] = function($email) {
$headers = array(
'From: ' . $email->from,
'Reply-To: ' . $email->replyTo,
'Return-Path: ' . $email->replyTo,
'Message-ID: <' . time() . '-' . $email->from . '>',
'X-Mailer: PHP v' . phpversion(),
// changed:
'Content-Type: text/html; charset=utf-8',
'Content-Transfer-Encoding: 8bit',
);
ini_set('sendmail_from', $email->from);
$send = mail($email->to, str::utf8($email->subject), str::utf8($email->body), implode(PHP_EOL, $headers));
ini_restore('sendmail_from');
if(!$send) {
throw new Error('The email could not be sent');
}
};
The contact form plugin then would need a new option to set the email service manually.
@chrisbalt would you be happy with this solution? You could make this work right now if you added the above email service and called it mail
, thus overwriting the default service.
from kirby-uniform.
@mzur I think you're right, it seems that either modifying the existing service–or adding a new service adopter–with the Content-Type
properly set is the only way to go. Could instrument a somewhat-elegant solution if a new mail service could be defined outside of the Kirby toolkit. Could then detect some string (like "html") in the snippet filename, which would trigger use of the html-mail
service. Until then, this works just fine.
Thanks for the response.
from kirby-uniform.
An option to choose a (custom) email service will be added in v1.3 (#11).
from kirby-uniform.
👍 @mzur You should add this to the plugin and/or to the README.md!
from kirby-uniform.
I think it's rather for the Toolkit to implement this and allow different content types with the mail
service or provide a new html-mail
service. Feel free to request this feature 😉
from kirby-uniform.
Related Issues (20)
- Invalid CSRF token question HOT 3
- Without redirection errors accumulate over time when form is submitted multiple times HOT 3
- Incompatibility with Kirby 3.6 : Str::template() parameters deprecated HOT 2
- Custom classes HOT 1
- Choose Date Format for Form Fields HOT 3
- PHP Deprecated htmlspecialchars(): Passing null to paramete HOT 4
- Plugin is not moved by `getkirby/composer-installer` HOT 3
- Post/Redirect/Get not working HOT 1
- Character "&" gets "&" HOT 2
- Bug with Honeypots guard and the autocomplete attribute HOT 2
- RCP: "done" closure HOT 5
- Allow body in email action HOT 6
- Distinguish between validation errors and server/action errors HOT 2
- Creation of dynamic property Uniform\Actions\EmailSelectAction::$data is deprecated HOT 1
- Error on form submission after update to PHP 8.1 HOT 2
- Option for a custom message in guards HOT 1
- [K4] Issue with form submission
- [K4] 4.0 Compatibility HOT 9
- Plugin not moved to plugins folder HOT 3
- Translations not working properly HOT 6
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 kirby-uniform.