Skip to content
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

Line breaks in message body result in 4 newlines instead of 2 #214

Closed
dgsiegel opened this issue Mar 24, 2022 · 1 comment
Closed

Line breaks in message body result in 4 newlines instead of 2 #214

dgsiegel opened this issue Mar 24, 2022 · 1 comment
Labels

Comments

@dgsiegel
Copy link

Description

Due to $body = preg_replace('/\R/u', "\n\n", $body); in https://github.com/craftcms/contact-form/blob/v2/src/Mailer.php#L216 (introduced with ae8dd32), all newlines in a textarea field will be replaced by two newlines. Adding the following into the textarea field:

foo
bar

text after empty line

gives this:

foo

bar




text after empty line

Steps to reproduce

  1. Add a contact form like described in the readme, e.g.
  {{ tag('textarea', {
        text: message.message ?? '',
        id: 'message',
        name: 'message',
    }) }}
  1. Look at the resulting text version of the email.

Additional info

  • Craft version: 3.7.2
  • PHP version: 8
@brandonkelly
Copy link
Member

Thanks for reporting! Just released 2.5.1 with a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants