Re: Email Body

From: Date: Thu, 23 Oct 2003 13:22:19 +0000
Subject: Re: Email Body
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-167264@lists.php.net to get a copy of this message
I use str_pad() for this, it can handle strings that vary in length much better then tabs: tab way: echo "long long name\t1000\t200.00\n"; echo "name\t10\t2.00\n"; output: long long name 1000 200.00 name 10 2.00 str_pad way: echo str_pad('long long name', 20,' ').
     str_pad('1000', 10,' ',STR_PAD_LEFT).
     str_pad('200.00', 10,' ',STR_PAD_LEFT).
     "\n";
echo str_pad('name', 20,' ').
     str_pad('10', 10,' ',STR_PAD_LEFT).
     str_pad('2.00', 10,' ',STR_PAD_LEFT).
     "\n";
output:
long long name            1000    200.00
name                        10      2.00
Marek micro brew wrote:
I am sending an email using mail() and it works fine. But the formatting of the body of the email is wrong. I want to format part of it in columns sort of like this:
Name       Quantity          Price
Can this be done neatly without using an html email? Also what is the trick to making line returns display properly in the email client? I've tried using \r\n with no luck. I also tried \n. The characters show in the email but no line breaks. Any suggestions? TIA, Mike __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com


« previous php.general (#167264) next »