faqts : Computers : Programming : Languages : PHP : kms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 9 people (78%) answered Yes
Recently 2 of 4 people (50%) answered Yes

Entry

Are <PRE> tags required around the mail() function?

Feb 2nd, 2001 23:47
Philip Olson, Pavel Prishivalko, mike gifford,


No.
<pre> is an HTML tag, mail() does not use HTML tags (unless you want to 
send HTML email but that's not the question here).  Essentially, if you 
have a message like this :
    Hello, how are you
    doing today I am 
    doing fine.
To have that remain as such, you can use linefeeds ( \n ), see :
    http://www.php.net/manual/en/language.types.string.php
Essentially, this will do the trick :
    Hello, how are you\n
    doing today I am\n
    doing fine.\n
This question "makes sense" in that putting the above in <pre> will 
have a similar effect but only to the browser, not within the use of 
mail().  There are also padding functions such as :
    http://www.php.net/manual/en/function.str-pad.php
That can help deal with this.