Jump to content
Sign in to follow this  
aysiu

Text from blob displaying differently in email than on webpage

Recommended Posts

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.

post-166621-0-15737100-1389280235_thumb.jpg

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.