-
Notifications
You must be signed in to change notification settings - Fork 93
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
"Message Template" setting #72
Comments
+1 |
Hah, I don't even remember posting this FR, but worth mentioning that a plugin can take over the message rendering using the beforeMessageCompile event (v1) or beforeSend event (v2). |
I know that... But it seems to be hard to achieve and kind of buggy. I mean, the advantage over other add-ons it's that it's free and easy... If I'd had to customize it, there's no point in using this add-on. Hiding the reply email and name within the "reply to" field is just not so very natural... It's just adding:
before
+💯 |
@outline4 thanks |
@outline4 Where did you add these lines?? |
Please include such functionality. Honestly, its pretty much basic thing to have in any contact form plugin. |
A template would be nice. A little enchantment for now; |
@KevinBeckers I just wrote a simple Craft CMS module to solve this problem, if it's of interest. It can probably be done in a far more elegant way, but this works for my use case. https://github.com/LukePeters/contactformextras |
+1 |
Yes please, the ability to set a template would be very useful! |
I'm trying to do this with the beforesend event but this doesn't seem to do anything at all. When following the code of contact-form v2, the message is already compiled before this event is fired. Also, there is a foreach on line 119 in Mailer.php which is not using the $event->message. So am i correct when saying this is impossible to achieve? |
N.V.M. i made a stupid assumption/mistake. Here is the code for people who want to achieve the same. Event::on(Mailer::class, Mailer::EVENT_BEFORE_SEND, function(SendEvent $e) {
// Change whatever you want in your submission data ($e->submission->message)
$e->message->setTextBody($text);
$e->message->setHtmlBody($html);
}); |
This could be used to customize the body contents, such as include the sender's email address within the message body.
The text was updated successfully, but these errors were encountered: