Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Aug 24, 2017 5:43 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Sending endofline via HTTPSocket.Get
PostPosted: Fri May 31, 2013 5:11 pm 
Offline

Joined: Fri Jun 02, 2006 1:43 pm
Posts: 209
Location: Santa Ynez, CA
Having experienced a lot of trouble sending emails with RS, mostly due to ISPs blocking ports 25 and 587, I wrote a PHP program that gets the email address, subject and body via HTTPSocket.Get from my RS program. It works fine except that my attempts to force a linefeed in the body have all failed. I have tried:

1. Using the RS EndOfLine in the body. Result is the PHP programs reports the message was not sent.

2. Using \n in the body. This works in PHP scripts I have written for sending emails, but in this case, it just prints the \n as part of the message rather than as a line feed/carriage return.

3. Using %0d in the body. This seems a natural since I have to use %20 in place of all the spaces between words. It works if I copy the URL string to the clipboard and paste it into my browser. However it does not work if the same URL string is sent from RS with the HTTPSocket.Get function. The result is the email address and subject are sent, but the body of the email is blank. I suspect that RS is sensing the %0d (the ASCII carriage return character) as the end of the message. I also tried %0a, the ASCII line feed character, with the same results.

Does anyone have a suggestion as to how to get around this problem?


Top
 Profile  
Reply with quote  
 Post subject: Re: Sending endofline via HTTPSocket.Get
PostPosted: Fri May 31, 2013 6:49 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
Just a guess, but try using EndOfLine.Unix in places you need the \n (0x0A) character.

_________________
Boredom Software


Top
 Profile  
Reply with quote  
 Post subject: Re: Sending endofline via HTTPSocket.Get
PostPosted: Mon Jun 03, 2013 8:11 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
dgdavidge wrote:
3. Using %0d in the body.
Is unlikely to work, because 0x0D is the return character, not the linefeed 0x0A (%0A) which just about all servers recognise as a line end terminator.

Most pertinent RFCs I have read specify \r\n as the preferred line ending, with an advisory that \n should also be recognised by server applications. Sadly, not all developers find time to read RFCs and there are plenty of Windows servers which only recognise \r\n.

Whatever platform you compile on, using endofline.windows in your client applications, should provide maximum compatibility with both Windows and Nix servers.

_________________
Yes it's me in the avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: Sending endofline via HTTPSocket.Get
PostPosted: Mon Jun 03, 2013 6:26 pm 
Offline

Joined: Fri Jun 02, 2006 1:43 pm
Posts: 209
Location: Santa Ynez, CA
I finally got it to work using %0a@0d. In fact it gave me a double line feed. Why %0a and %0d did nothing mystifies me. Any version of EndOfLine, whether plain, .UNIX or .windows caused the PHP program to fail and not send the email at all. Thanks for your help.


Top
 Profile  
Reply with quote  
 Post subject: Re: Sending endofline via HTTPSocket.Get
PostPosted: Tue Jun 04, 2013 1:30 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
dgdavidge wrote:
I finally got it to work using %0a@0d. In fact it gave me a double line feed. Why %0a and %0d did nothing mystifies me.

Have you tried %0d%0a, in that order. An end of line is specifically \r\n (0x0d0a) and not \n\r (0x0a0d).

Quote:
Any version of EndOfLine, whether plain, .UNIX or .windows caused the PHP program to fail and not send the email at all.
PHP is embedded (transported) within HTML, so whatever you send to the PHP processor must conform to the HTML protocol. Whitespace characters have little meaning within HTML.

EndOfLine.Windows equates to a string of the two bytes 0x0d, 0x0A, Which are whitespace ASCII characters, ignored by the HTML parser. Sending the string "%0a%0d", takes 6 bytes but it informs the HTML parser that it needs to substitute the binary bytes (0x0a0d). Similarly "%22" will substitute double quotes, "%09" will substitute a tab character, etc etc.

Sorry if I did not make it clear that you would need to send the line ending sequence as in a way the PHP processor can recognise.

_________________
Yes it's me in the avatar


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group