aysiu Posted January 9, 2014 Share Posted January 9, 2014 This is rather odd, but I'm pulling text out of a blob from a database most people have never heard of (4D), using PDO. When I pull the data out and display it on a webpage using PHP, it shows up just fine. When I pull the same data out and email it using the PHP mail function, it shows up weirdly spaced (see the attached screenshot to see the difference--weird spacing on top, proper spacing below). In the regular webpage display, I'm using the variable PDO pulled out: echo $row['EMAIL_BLB']; For email, I'm using that same variable to be the message: $message=$row['EMAIL_BLB'] For the headers, I've tried using $headers .='Content-type: text/html; charset=iso-8859-1' . "\r\n"; or $headers .='Content-type: text/html; charset=utf-8' . "\r\n"; or even no charset specified at all. Same result, regardless of charset. Has anyone ever since this behavior before? Is there a PHP function that would fix this before outputting to a message? Thanks in advance. P.S. Unfortunately, it's not an option to originally store the data as regular text instead of a blob. It's a blob of text, which displays fine on a webpage... just not in an email. Quote Link to comment Share on other sites More sharing options...
Drongo_III Posted January 9, 2014 Share Posted January 9, 2014 Have you checked the source html of the email to ensure that is free from some unexpected addition? Email clients are obviously renowned for rendering issues. Possible idea at least. Quote Link to comment Share on other sites More sharing options...
aysiu Posted January 9, 2014 Author Share Posted January 9, 2014 Actually, that doesn't solve the problem, but that may point me in the right direction. Thanks. The source appears to be just plain text... no HTML whatsoever. Even though I've done HTML emails in the past with no problem, there's something about this blob of text that's negating the HTML piece. Quote Link to comment Share on other sites More sharing options...
aysiu Posted January 13, 2014 Author Share Posted January 13, 2014 No, it's definitely something with the blob text. If I send a regular HTML email in the message body not referencing the blob, the HTML turns out just fine (bold, italics, hyperlinks). If I send the blob, the text is all weird without spaces. Anyone else have ideas for things to try or test? Quote Link to comment Share on other sites More sharing options...
litebearer Posted January 13, 2014 Share Posted January 13, 2014 Thought from left field... If the blob is just text (ie no special characters/formatting/etc), perhaps as a test write it to a file, then (a) attach file to email and (b) read file into a new variable and insert that into the email. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.