0

I am using a webform to send an email. The webform contains a textarea field.

I have noticed that if I enter a paragraph of text in the textarea field, then that same text is split into multiple lines in the email I receive.

So rather than being a single line of text which is wrapped within the email, it looks like the paragraph is split into separate lines (as shown in following image): enter image description here

This is puzzling since if I check the body of the email using hook_mail_alter() the paragraph appears as a single line of text:

enter image description here

I can't work out why this is occurring. I am not sure if this is something that webform is doing or if it is something being done by the mail server itself (could it be something to do with plain text email protocal perhaps?). Was hoping someone would be able to enlighten me on the likely cause of this issue and how to solve it?

0

The issue seems to be with the plain text format of the mail.If you want to send mail content with designed structure then you must use Mime mail module.Once you enable the module you can use a HTML formatter for the textarea that is used to structure the mail. Let me know if you face any issues.

0

RFC 2822 says that each line of body text should be no longer than 78 characters and be terminated by \r\n, for a total of 80 characters on the line.

Drupal core follows this standard and wraps your text to make sure your email complies with this specification. There is no way to send a specification-compliant plain text email without wrapping the lines.

Instead, you can send HTML email, where your text will look like this is all on one line. (In actuality, the body of the email is still limited to 78 characters but, because it is interpreted as HTML, line breaks are ignored when displaying the formatted text.) Drupal core does not support HTML directly, instead you will need to install a contributed module such as Mime Mail to allow you to send HTML email.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.