Skip to content
lsl.devlsl.devLSL Dev

Email

Looking for the current API? Open the email reference →

Event notes

The email queue is associated with the prim and any script in the prim can access it.
The prim's email address is its key with "@lsl.secondlife.com" appended, llGetKey() + "@lsl.secondlife.com"Preview grid email address are constructed differently: llGetKey() + "@lsl." + grid + ".lindenlab.com"; for the main beta grid set grid to "aditi"..

Wiki description

Triggered as a result of calling llGetNextEmail where there is a matching email in the email queue.

Specification

The email event is triggered as a result of calling llGetNextEmail when there is an email that matches llGetNextEmail's optional filters. The first email that matches the filters is removed from the email queue and its data is used as the parameters for this event. If no email matches the filters but the queue is not empty this event is not triggered. Besides the effects of filtering, the email queue is FIFO.

Caveats

  • The email queue is limited to 100 emails, any email after that is bounced.
  • The message field may have a maximum of 1000 single-byte characters. This count includes the header information (address, subject, etc).
  • Emails sent from within SL will have their message body prefixed with a header detailing the originating prim. See llEmail for more details.
  • 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).
  • Due to bug BUG-229767, an object's email queue can still become suspended until the object crosses a region border (neither a region restart nor a script reset helps). First analysis has revealed a potential workaround, by implementing a delay of about 30 seconds before first trying to send email to a freshly rezzed script - apparently registering the email(...) event handler can take quite some time, and emails arriving prior to said registry process is what gets the entire queue stuck. Official Linden response still pending.

Examples

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

    timer()
    {
    //  get next email, don't filter by sender or subject
        llGetNextEmail("", "");
    }

    email( string time, string address, string subject, string message, integer num_left )
    {
    //  if we received an email from an object within Second Life
        if (llGetSubString(address, -19, -1) == "@lsl.secondlife.com")
//      {
            message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
//      }

    //  PUBLIC_CHANNEL has the integer value 0
        llSay(PUBLIC_CHANNEL, message);

    //  if there's another email in the queue waiting
    //  get next email, don't filter by sender or subject
        if(num_left)
            llGetNextEmail("", "");
    }
}

Notes

For tips on how to process emails sent from within SL, see the entry on llEmail.

See also: functions

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:Issues/SVC-23

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-23|Region incoming [[email]] queue for objects becomes suspended|type=bug|resolution=wont}}

Template:Issues/SVC-391

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-391|[[llEmail]] and [[llHTTPRequest]] do not handle non-ASCII characters|type=bug}}

Template:Issues/SVC-412

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-412|Include "Content-Type: text/plain; charset{{=}}UTF-8" header in the messages forwarded from second life.|type=bug}}

Template:Issues/SCR-499

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SCR-499|[[llEmail]]s to objects not in the same region [[email|arrive]] without a body or do not arrive at all.|type=bug|resolution=unres}}

Template:Issues/BUG-229767

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|BUG-229767|Object-to-object email sporadically fails|type=bug|resolution=unres}}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.