Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

emails not working right - no linefeeds?

Merlin Alphabeta
Registered User
Join date: 12 Feb 2006
Posts: 83
03-26-2006 12:06
I'm seeing some really strange behaviour - one script is working according to spec, the other one appears to be completely broken. I'd really appreciate any advice or third party testing here.

According to the LSL wiki, emails always have a form that includes linefeeds at the end of each line, and two before the actual start of the message, when sent by in-game objects.

I was having a hard time parsing these emails - something seemed off with the formatting - so I wrote a little test script to verify what I was seeing- and sure enough - the emails I'm receiving don't have linefeeds!

Now I'm using two objects for communication - one object is receiving the linefeeds and working well - the other is not. This test can be done with only one object if you just send an e-mail with linefeeds in it.

I used the following code to test it:

CODE

default {
state_entry() {
llSetTimerEvent(1.0);
}

on_rez(integer num) {
llSetTimerEvent(1.0);
}

email(string time, string address, string subj, string message, integer num_left) {
list messagedata = llParseString2List(message, [ "\n" ], [ ]);
integer i = 0;
for(i = 0; i < llGetListLength(messagedata); i++) {
llOwnerSay((string)i + ": " + llList2String(messagedata, i));
}
}

timer() {
llGetNextEmail("", "");
}

touch(integer num_detected) {
string emailaddress = (string)llGetKey() + "@lsl.secondlife.com";
llSay(0, "Test sending to the following address " + emailaddress);
}
}


You can try this out by copying/pasting the above into a prim's script, touching it to get the emailaddress, and then sending something with linefeeds in with an external email program. Normally you'd expect to see something like:
TestObject: 0: line1
TestObject: 1: line2

etc.

or if it's an email from an in-world object
TestObject: 0: Object-Name: Test Sender
TestObject: 1: Region: Bowfin (262144, 254720)
TestObject: 2: Local-Position: (158, 15, 89)
TestObject: 3:
TestObject: 4: message goes here

(yes that location is where I've been doing my testing :) stop by and visit sometime)

But this is what I got during testing (I'm sending the owner's key as the only data in the message):

TestObject: 0: Object-Name: Test Sender Region: Bowfin (262144, 254720) Local-Position: (158, 15, 89) b274e516-89a5-4d60-aa7d-e84402bd895c

The message doesn't appear to have any linefeeds in it! Like I said I have one object using the wiki-suggested parsing method which works fine. This test object was originally doing that and ended up writing out the following:

CODE

string MessageWithoutHeaders = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
llOwnerSay(MessageWithoutHeaders);


TestObject: bject-Name: Test Sender Region: Bowfin (262144, 254720) Local-Position: (158, 15, 89) b274e516-89a5-4d60-aa7d-e84402bd895c

This led me to believe that it wasn't finidng any double line feeds and was returning the string without the first character - which is the behaviour expected if you ask it to llDeleteSubString(message, 0, 0) - this was when I developed the more lengthy test script above.

Has anyone else run into similar problems?
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
03-26-2006 12:19
I've had this issue when dealing with objDNS . . . it seems that the objDNS system sometimes kills line feeds, sometimes not. Once I went back to direct emails worked as planned.
Merlin Alphabeta
Registered User
Join date: 12 Feb 2006
Posts: 83
03-26-2006 12:21
What's objDNS?