Jump to content

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

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.

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.