Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Post By Email: Line breaks in email reply get replaced with spaces
Avatar
chris.crabtree
Member
Free Members
sp_UserOfflineSmall Offline
Jan 22, 2013 - 11:50 pm

So when I reply by email with a simple message like so:

A 4-line reply. Line 1.
Line 2.
Line 3.
Line 4.

The text of the message that's actually posted in the forum becomes:

A 4-line reply. Line 1. Line 2. Line 3. Line 4.

It looks to me like the content filtering may be a bit too aggressive.

Specifically, in sp-email-post-imap.php, the function sp_process_inbox_imap() does a number of str_replace() operations on the raw content. I'm sure I don't understand the deeper purpose behind some of these, but the culprit in my specific example case here looks to be this line:

$content = str_replace(chr(13).chr(10), ' ', $content);

Wondering if, rather than a space, the replacement character should be a "\n" newline instead?

Thanks!

p.s. if it matters, I replied to the email via gmail's standard web UI via the Chrome browser on a Mac.

 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 23, 2013 - 5:21 am

I considered the filtering, as at the first release, to be what I can only describe as 'rough'. I think my comment to my colleagues here was that once this starts to get used we can expect all kinds of filtering/display issues which will need addressing. This is to do with the non-standard way that different email clients deal with the email body content before sending it off. And some really do make a mess of it. The one I have the most problems with being Apple Mail although it should be OK using that at the moment.

GMail should be OK so I am surprised you are seeing a problem there. But it may well have changed of course. So should, I believe, PostBox - and therefore old Thunderbird clients - which Steve uses if I am not mistaken.

Anyway - the loose plan is that we take these issues on board as and when they are raised - adjust the filters until we get them right for as broad a collection of clients as are being used - and slowly clean up the code to suit. So my best suggestion - especially as you seem to know your way around the code - is tell us what you need exactly to get it right and then we will try that here and if no ill-effects in other clients we test with - then we will adopt it into the core code.

andy-signature.png
YELLOW
SWORDFISH
Avatar
chris.crabtree
Member
Free Members
sp_UserOfflineSmall Offline
Jan 23, 2013 - 8:56 am

Sounds reasonable to me! I understand how loose different email clients can be with their formatting, so it will definitely be an evolution.

So this is my change. I tested it with multi-line text last night and it worked as expected.

Before:

$content = str_replace(chr(13).chr(10), ' ', $content);

After:

$content = str_replace(chr(13).chr(10), "\n", $content);

Thanks!

 

 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 23, 2013 - 12:12 pm

That's great thanks. Noted and we will try that out this end to see if it has any disturbing effects with the other clients we are using.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625