-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redefine 'Content-type' email header in order to send using HTML snippets #7
Comments
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 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 |
@mzur I think you're right, it seems that either modifying the existing service–or adding a new service adopter–with the Thanks for the response. |
An option to choose a (custom) email service will be added in v1.3 (#11). |
👍 @mzur You should add this to the plugin and/or to the README.md! |
I think it's rather for the Toolkit to implement this and allow different content types with the |
Currently, if a user (dev) selects a snippet that contains HTML (such as your example
sendform-table.php
snippet, the HTML will deliver as text and render as such. As far as I can see, the only way to override this is to redefine theContent-Type
property currently defined in the email class within the Kirby toolkit. Alternatively, a duplicate service adopter could be created with this one line changed, but that does not seem desirable.Is there a way for
SendForm.php
to force the definition of this header to change?The text was updated successfully, but these errors were encountered: