电子邮件的TextArea换行符 [英] TextArea line breaks for e-mail

查看:127
本文介绍了电子邮件的TextArea换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从文本区域(html)提取文本并插入换行符.现在,如果我输入要通过电子邮件发送的信息,它将所有文本放在同一行,而没有任何换行符.

How can I take the text from a textarea (html) and insert line breaks. Right now, if I input info to send out as an e-mail, it puts all the text on the same line without any line breaks.

使用$ _POST ['field']从表单中获取数据并使用PHP邮件发送.

Using $_POST['field'] to get the data from the form and sending using PHP mail.

推荐答案

使用\ n换行,或\ r \ n换行后再换行

use \n for new line, or \r\n for return followed by new line

即.

<?php
printf("This is the first line. \n");
printf("This is the second line");
?>

即.用换行符替换
html标签:

ie. to replace
html tag with newline:

str_replace ('<br>' , '\r\n', $_POST['field'])

或者将您发送的电子邮件设置为html编码(添加html标头)

alternativly set the email you are sending out to be html encoded (add html header)

这篇关于电子邮件的TextArea换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆