Welcome Guest, Not a member yet? Register   Sign In
how to format text in email body
#1

[eluser]megabyte[/eluser]
i'm trying to create an email receipt for an order.

I'm sending the email as text and not html

I'm trying to pad the columns so that there's space between the name, qty and price.

Unfortunately:

Code:
echo str_pad($input, 20, ' ');

does not work. It only pads the string with a single character.

if I do this:

Code:
echo str_pad($input, 20, '#');

The it pads it, because I'm using an actual character.

Does anyone know how to do this with empty spaces?
#2

[eluser]danmontgomery[/eluser]
http://www.sightspecific.com/~mosh/WWW_FAQ/nbsp.html
#3

[eluser]megabyte[/eluser]
That does not work because the email is a plain text not html email.

I tried it already.

You also test it like this in your browser:

Code:
<?php
header('Content-Type: text/plain');

echo str_pad('test', 50, ' ', STR_PAD_LEFT);
?>


Any other ideas?
#4

[eluser]megabyte[/eluser]
OK, so here's the solution just in case others wanna know.

Code:
echo  str_pad('Test', 100, chr('0x20'));




Theme © iAndrew 2016 - Forum software by © MyBB