mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #848 from LukeAmos/issue/814
FIX: Fixes issue #814 added email template for plain text, as to avoid raw HTML ending up in plain text emails. https://github.com/silverstripe/silverstripe-userforms/issues/814 ># HTML is present in the PlainText Body of emails > >I only noticed this because we started using PostMark (which seems to reject HTML emails which have HTML in the Plain Text Body). I suspect though that this will make emails more likely to be seen as spam? > >I have tracked the issue (I think) back to this line: /code/Control/UserDefinedFormController.php@master#L294 > >Looks like the HTML template is being used by both. > >I have checked and cannot see this issue reported anywhere else. Is it worth doing a PR with a fix?
This commit is contained in:
commit
85408afdd5
@ -290,8 +290,8 @@ JS
|
||||
if ($recipients = $this->FilteredEmailRecipients($data, $form)) {
|
||||
foreach ($recipients as $recipient) {
|
||||
$email = Email::create()
|
||||
->setHTMLTemplate('email/SubmittedFormEmail')
|
||||
->setPlainTemplate('email/SubmittedFormEmail');
|
||||
->setHTMLTemplate('email/SubmittedFormEmailHtml')
|
||||
->setPlainTemplate('email/SubmittedFormEmailPlain');
|
||||
|
||||
// Merge fields are used for CMS authors to reference specific form fields in email content
|
||||
$mergeFields = $this->getMergeFieldsMap($emailData['Fields']);
|
||||
|
10
templates/email/SubmittedFormEmailPlain.ss
Normal file
10
templates/email/SubmittedFormEmailPlain.ss
Normal file
@ -0,0 +1,10 @@
|
||||
<%-- Note: content is already escaped in UserDefinedFormController::process --%>
|
||||
$Body.RAW
|
||||
|
||||
<% if not $HideFormData %>
|
||||
*
|
||||
<% loop $Fields %>
|
||||
* <% if $Title %>$Title<% else %>$Name<% end_if %>
|
||||
* $FormattedValue
|
||||
<% end_loop %>
|
||||
<% end_if %>
|
@ -175,8 +175,8 @@ class UserDefinedFormTest extends FunctionalTest
|
||||
$result = $recipient->getEmailTemplateDropdownValues();
|
||||
|
||||
// Installation path can be as a project when testing in Travis, so check partial match
|
||||
$this->assertContains('email' . DIRECTORY_SEPARATOR . 'SubmittedFormEmail', key($result));
|
||||
$this->assertSame('SubmittedFormEmail', current($result));
|
||||
$this->assertContains('email' . DIRECTORY_SEPARATOR . 'SubmittedFormEmailHtml', key($result));
|
||||
$this->assertSame('SubmittedFormEmailHtml', current($result));
|
||||
}
|
||||
|
||||
public function testEmailTemplateExists()
|
||||
|
Loading…
Reference in New Issue
Block a user