Don't click here unless you want to be banned.

LSL Wiki : email

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
email(string time, string address, string subj, string message, integer num_left)

Triggered when a request by llGetNextEmail is answered. Returned are the email's time, sender's address, subject in subj, the message itself and how many more emails are queued for this object in num_left.

time is a UNIX timestamp (integer) typecast as a string, similar to that returned by llGetUNIXTime.

address and subj are limited to 78 characters each.
message is limited to 1000 characters. (4KByte, not 1000 byte)

The message field is formatted as follows:
Object-Name: object_name\n
Region: region_name (region_corner _coordinates)\n
Local-Position: (local_pos)\n
\n
message_text

Where:
object_name is the name of the sending object. To get the objects key, look at the sender's address.
region_name is the name of sim the object is located in. This is as returned by llGetRegionName.
region_corner_coordinates is the region's Region Corner. This is in the format x,y with no z component. t is not enclosed in <>'s.
local_pos is the sending object's local position. It is in the format x,y,z . It is not enclosed in <>'s.
message_text is the actual text sent in the message string in llEmail.

To remove the headers attached to the beginning of the message, use this line:
message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);

Notes:

Example:
default {
    state_entry() {
        llEmail((string)llGetKey() + "@lsl.secondlife.com", "Test!", "This is a test message."); // Send email to self.
        
        llSetTimerEvent(2.5); // Poll for emails. (Yes, that is a retarded way on an event-based system!)
    }
    
    timer() {
        llGetNextEmail("", ""); // Check for email with any sender address and subject.
    }
    
    email(string time, string address, string subj, string message, integer num_left) {
        llSay(0, "You got mail! " + (string)num_left + " more mails.");
        llSay(0, llList2CSV([time, address, subj, message]));
        if (num_left == 0) llSetTimerEvent(0.0); // Stop timer when there's no more email.
    }
}

To send an email, use llEmail.


Events | Communications
There are 4 comments on this page. [Display comments/form]