Re: [PHP] Email Body

2003-10-29 Thread micro brew
Marek,

Thanks for the tip.  str_pad() worked like a charm. 
I've never had a text email look so nice.  Thanks
again.  :)

Mike

--- Marek Kilimajer <[EMAIL PROTECTED]> wrote:
> 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 name1000200.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 name1000200.00
> name10  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
> > 
> 


__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Email Body

2003-10-23 Thread Don Read

On 22-Oct-2003 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?
> 

sprintf("%-25 %2d %9.2f\n", 
  $name, $qty, $price);

> 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?
> 

double-quotes around your string?

Regards,
-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Email Body

2003-10-23 Thread Marek Kilimajer
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  1000200.00
name10  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 name1000200.00
name10  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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Email Body

2003-10-22 Thread John W. Holmes
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?
\t is a tab. You can use that to line things up.

Like the other guy said, make sure your strings are within double 
quotes, otherwise things like \t and \n do not get evaluated.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Email Body

2003-10-22 Thread Rolf Brusletto
didn't mention this before, but the difference between the two examples 
if you hadn't noticed already is that the first is single quoted, and 
the second, double quoted.

Rolf

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
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Email Body

2003-10-22 Thread Rolf Brusletto
yo -

\n should work, but it depends on which type of quotes you use... see 
the following..

$content = 'this is the first line\n this is the second line\n this is 
the third line';

would return

this is the first line\n this is the second line\n this is the third line

as opposed to

$content = "this is the first line\n this is the second line\n this is 
the third line";

which would return

this is the first line
this is the second line
this is the third line
As for the formatting... I haven't been able to format a text email 
perfectly myself..

Rolf Brusletto
http://www.phpExamples.net
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
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Email Body

2003-10-22 Thread micro brew
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] email body text extraction.

2002-02-19 Thread Bogdan Stancescu

E-mail is formatted just like HTTP messages - just split it in two after 
the first \r\n\r\n and the first part is the header and the rest is the 
body. You'll have to look for a line starting with "Subject:" in the 
header and store the second part. You'll have a small problem if you 
expect to also get attachments...

Bogdan

Athar Hameed wrote:

>I want to check for new emails (with a specific subject) and extract the
>message body. This message body will be used to update specific parts of my
>website. Any ideas?
>
>Many thanks in advance.
>
>Regards.
>Athar Hameed
>[EMAIL PROTECTED]
>
>
>P.S. I would like to meet other PHP programmers in Islamabad, Pakistan. If
>anyone's interested, mail me at [EMAIL PROTECTED]
>
>
>
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] email body text extraction.

2002-02-19 Thread Athar Hameed

I want to check for new emails (with a specific subject) and extract the
message body. This message body will be used to update specific parts of my
website. Any ideas?

Many thanks in advance.

Regards.
Athar Hameed
[EMAIL PROTECTED]


P.S. I would like to meet other PHP programmers in Islamabad, Pakistan. If
anyone's interested, mail me at [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php