From Second Life Wiki
Revision as of 12:12, 11 October 2008 by Chaz Longstaff (Talk | contribs)

Jump to: navigation, search


Event: email( string <span title="In the (string)llGetUnixTime format" style="border-bottom:1px dotted; cursor:help;">time, string address, string subject, string message, integer num_left ){ ; }</span>

Triggered when task receives email

• string time In the (string)llGetUnixTime format
• string address
• string subject
• string message
• integer num_left The number of emails left in the email queue


  • The email queue is limited to 100 emails, any email after that is bounced.
  • Due to bug SVC-23 (present since 2005), objects may stop receiving emails completely until either the region is restarted or the object crosses a region boundary (resetting the script doesn't help). Emails sent may eventually be received after a restart/region-cross. Hence, don't rely on this event for reliable inter-region messaging.
  • The message field may have a maximum of 1000 characters. This count includes header information, which is pre-pended, and over which you have no control.
All Issues ~ Search JIRA for related Bugs


The message field for email sent by llEmail will look like this:

Object-Name: Name of the object that sent the email
Region: The name of the Region (PLUS, in round brackets, the region_corner _coordinates)
Local-Position: the local position of the object sending the email


(Note: to be clear, the labels Object-Name:, etc, are actually returned to you as well.)

To get just the pure message text, minus the headers, do this:

<lsl> message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1); </lsl>

To get just 1 of the header items, do this:

<lsl> list TempList = llParseStringKeepNulls(message, ["\n"], []); string objname = llList2String(TempList,0); string tmpregion = llList2String(TempList,1); string localpos = llList2String(TempList,2); </lsl>

To get a pure region name, do this:

<lsl> string right (string src, string divider) {

               integer iStart = llSubStringIndex( src, divider ) + 1;
               string result = llGetSubString( src, iStart, llStringLength(src) - 1 ) ;
      return result;


string left (string src, string divider) {

               integer iStart = llSubStringIndex( src, divider ) + 1; 
               string result = llGetSubString( src, 0, iStart -1) ;
      return result;


list TempList = llParseStringKeepNulls(message, ["\n"], []); string tmpregion = right(llList2String(TempList,1),": "); tmpregion = llStringTrim(left(tmpregion," ("),STRING_TRIM); </lsl>

This application uses email to have objects check with a central server to see if the owner has the latest version. In the objects: <lsl> string version = "1"; // string type = "lolcube"; default {

   on_rez(integer start_param)

}</lsl> The server: <lsl> default {

   email( string time, string address, string version, string message, integer num_left )
       if ((integer)version < 2)
           list info = llCSV2List(llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1));
       integer i;
       for (i = 0; i < num_left; i++)

} </lsl>

See Also


•  llEmail
•  llGetNextEmail

Deep Notes


event void email( string time, string address, string subject, string message, integer num_left );