Page 1 of 1
Plain Text Email Problem
Posted: Sun Jun 04, 2006 3:14 pm
by patch2112
Hello all, I'm going to be bald soon if I don't figure this out!!!
I'm sending a plain text email. There is a section in the code that does the following...
Code: Select all
if ($mail == "client") { $msg .= "Quantity: $row_2[2] - Colour: $row_2[1] - Size: $row_2[0]\r"; }
if ($mail == "brigade") { $msg .= "Stock Quantity: $row_2[2] - Colour: $row_2[1] - Size: $row_2[0]\r"; }
But the second option doesn't include a carriage return. If I put "\r\r" in, then I get 2. I've also tried all sorts of moving things around, trying "\n's" and so forth. Even tried adding the "\r" after this branch and still have the same problem.
It seems to be a length issue, as I can delete "Stock" from the second option, put it in the first, and the problem is reversed.
Any ideas?
Philip
Posted: Sun Jun 04, 2006 4:01 pm
by Ambush Commander
Try only using "\n"s.
ty
Posted: Sun Jun 04, 2006 4:03 pm
by patch2112
Thanks abush,
Same problem though...
Philip
Posted: Sun Jun 04, 2006 4:03 pm
by ok
1. Try the PHP Swift Mailer:
viewtopic.php?t=48055.
2. You can use HTML mail instead. Remeber to add these headers:
Code: Select all
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
3. Anyway, if you want to use a simple mail, single "\n" should do the job!!! (You can check the
PHP manual - mail() - Example 1. Sending mail)
No good
Posted: Mon Jun 05, 2006 8:38 am
by patch2112
Thanks OK, but still no dice.
I have a HTML emailer function built for HTML emails from this site, but I really wanted to keep this part plain text (mostly for simplicity...lol).
I've been experimenting still and came accross something peculiar (to me anyway).
When I take out all of the \n's and/or \r's, but leave spaces in the code...
Code: Select all
$display_var = "
Thank you for your order!
Below are details of your order. Please contact us as soon as possible if there are any problems with your order.
-----------------------------------------------------------------------";
The spaces are there in the email. Does this shed any light? I have root access, so maybe I've messed some setting up.
Does this help?
Philip
Posted: Mon Jun 05, 2006 11:09 am
by ok
Why not using HTML only for the newline("<br>")???
I thought about something...
Instead of "\n" or/and "\r", just use the real enter, i.e:
Code: Select all
$message = "Line 1
Line 2
Line 3
End Of Message";
Yep
Posted: Mon Jun 05, 2006 11:12 am
by patch2112
Thanks Ok,
I'm actually in process now of moving it to HTML. I've always sent (well, for the 2 years I've been doing this) multi-part, but really wanted it just to be simple, printable, and quick to develop, so I thought maybe plain text was the answer.
Just had to let go and head back over to html.
Thanks again,
Philip
PS: Couldn't use the "real enter" as I was looping to building rows. Have tables now which is better looking anyway.