Difference between revisions of "Email"

From Second Life Wiki
Jump to: navigation, search
Line 12: Line 12:
 
|caveats=*'''time''' is in the (string)[[llGetUnixTime]] format.
 
|caveats=*'''time''' is in the (string)[[llGetUnixTime]] format.
 
*The email queue is limited to 100 emails, any email after that is bounced.
 
*The email queue is limited to 100 emails, any email after that is bounced.
|examples
+
|examples=
 +
This application uses email to have objects check with a central server to see if the owner has the latest version. In the objects:
 +
<pre>
 +
string version = "1"; //
 +
string type = "lolcube";
 +
 
 +
default
 +
{
 +
    on_rez(integer start_param)
 +
    {
 +
        llEmail("5a634b27-f032-283f-2df2-55ead7724b23@lsl.secondlife.com",
 +
            version,
 +
            (string)llGetOwner()+","+type);
 +
    }
 +
}</pre>
 +
 
 +
The server:
 +
<pre>
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        llSetTimerEvent(15);
 +
    }
 +
   
 +
    timer()
 +
    {
 +
        llGetNextEmail("","");
 +
    }
 +
   
 +
    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));
 +
            llGiveInventory(llList2Key(info,0),llList2String(info,1));
 +
        }
 +
       
 +
        integer i;
 +
        for (i = 0; i < num_left; i++)
 +
        {
 +
            llGetNextEmail("","");
 +
        }
 +
    }
 +
}
 +
</pre>
 
|helpers
 
|helpers
 
|also_header
 
|also_header

Revision as of 23:44, 1 May 2007

Description

Event: email( string time, string address, string subj, string message, integer num_left ){ ; }

Triggered when task receives email

• string time
• string address
• string subj
• string message
• integer num_left

Caveats

  • time is in the (string)llGetUnixTime format.
  • The email queue is limited to 100 emails, any email after that is bounced.
All Issues ~ Search JIRA for related Bugs

Examples

This application uses email to have objects check with a central server to see if the owner has the latest version. In the objects:

string version = "1"; //
string type = "lolcube";

default
{
    on_rez(integer start_param)
    {
        llEmail("5a634b27-f032-283f-2df2-55ead7724b23@lsl.secondlife.com",
            version,
            (string)llGetOwner()+","+type);
    }
}

The server:

default
{
    state_entry()
    {
        llSetTimerEvent(15);
    }
    
    timer()
    {
        llGetNextEmail("","");
    }
    
    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));
            llGiveInventory(llList2Key(info,0),llList2String(info,1));
        }
        
        integer i;
        for (i = 0; i < num_left; i++)
        {
            llGetNextEmail("","");
        }
    }
}

See Also

Functions

•  llEmail
•  llGetNextEmail

Deep Notes

Signature

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