<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlEmail</id>
	<title>LlEmail - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlEmail"/>
	<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlEmail&amp;action=history"/>
	<updated>2026-10-25T11:12:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://wiki.osgrid.org/index.php?title=LlEmail&amp;diff=107&amp;oldid=prev</id>
		<title>Osgridadmin: Created page with &quot;==Function: llEmail( string address, string subject, string message );== Sends an email to address with subject and message. &lt;br&gt; • string 	address 	 &lt;br&gt;		 • string 	subj...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlEmail&amp;diff=107&amp;oldid=prev"/>
		<updated>2017-12-30T18:06:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Function: llEmail( string address, string subject, string message );== Sends an email to address with subject and message. &amp;lt;br&amp;gt; • string 	address 	 &amp;lt;br&amp;gt;		 • string 	subj...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Function: llEmail( string address, string subject, string message );==&lt;br /&gt;
Sends an email to address with subject and message. &amp;lt;br&amp;gt;&lt;br /&gt;
• string 	address 	 &amp;lt;br&amp;gt;		&lt;br /&gt;
• string 	subject 	 &amp;lt;br&amp;gt;		&lt;br /&gt;
• string 	message 	 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;		&lt;br /&gt;
The entire message (including the address, subject and other miscellaneous fields) can&amp;#039;t be longer than 4096 bytes combined. &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Specification&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
The message is prefixed with information about the prim sending the email. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;.5&amp;quot; style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
! bgcolor=&amp;quot;black&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Template  !! bgcolor=&amp;quot;black&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Example &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;pre&amp;gt;Object-Name: *prim* &lt;br /&gt;
Region: *simname* (*simpos.x*, *simpos.y*)&lt;br /&gt;
Local-Position: (*primpos.x*, &lt;br /&gt;
*primpos.y*, *primpos.z*)&lt;br /&gt;
&lt;br /&gt;
*message*&amp;lt;/pre&amp;gt; || &amp;lt;pre&amp;gt;Object-Name: Object&lt;br /&gt;
Region: Gibson (254976, 256000)&lt;br /&gt;
Local-Position: (117, 129, 50)&lt;br /&gt;
&lt;br /&gt;
The real message starts here.&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Caveats&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
• This function causes the script to sleep for 20.0 seconds.&amp;lt;br&amp;gt;&lt;br /&gt;
• There is a limit to the number of email messages an object can send in a given amount of time.&amp;lt;br&amp;gt;&lt;br /&gt;
• There is a limit of 500 messages from a single agent&amp;#039;s objects in a one hour period.&amp;lt;br&amp;gt;&lt;br /&gt;
• (Sept-2008) The Email Throttle was modified slightly, Per Prospero Linden&amp;#039;s comments: &amp;quot;there has long been a throttle that makes a single script sleep for 20 seconds after sending an email. The new throttle is per user... some were using many, many different scripts to send spam. (the new throttle applies) when the destination is outside of Second Life. I know that messages within the same region were not throttled (beyond the 20-second delay), and I *believe* that messages between different sims were not throttled (between the 20-second delay).&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
• Due to the bug SVC-23[c] (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&amp;#039;t help). Emails sent may eventually be received after a restart/region-cross. Hence, don&amp;#039;t rely on this function for reliable inter-region messaging. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
string email_address = &amp;quot;somebody@example.com&amp;quot;; // who will receive the messages&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() {&lt;br /&gt;
 &lt;br /&gt;
        //Send an email to a normal email account&lt;br /&gt;
        llEmail( email_address, &amp;quot;Look it&amp;#039;s an email subject line!&amp;quot;, &amp;quot;Testing 1 2 3&amp;quot; );&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    touch_start( integer num_detected ) {&lt;br /&gt;
        integer i = 0;&lt;br /&gt;
 &lt;br /&gt;
        // Send another email, telling who touched the prim.&lt;br /&gt;
        do&lt;br /&gt;
            llEmail( email_address, &amp;quot;No touching!&amp;quot;, &amp;quot;I was defiled by: &amp;quot; + llDetectedName(i) + &amp;quot;\nKey: &amp;quot; + (string) llDetectedKey(i) );&lt;br /&gt;
        while(++i &amp;lt; num_detected);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Useful Snippets&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
email( string time, string address, string subj, string message, integer num_left )&lt;br /&gt;
{&lt;br /&gt;
    if(llGetSubString(address, -19, -1) == &amp;quot;@lsl.secondlife.com&amp;quot;)//trim the header&lt;br /&gt;
        message = llDeleteSubString(message, 0, llSubStringIndex(message, &amp;quot;\n\n&amp;quot;) + 1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Notes&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
•  Because of the long delay on this function, it is often called from a second script triggered by link_message. &amp;lt;br&amp;gt;&lt;br /&gt;
• If you are sending email to a prim within Second Life, its address is [key]@lsl.secondlife.com &amp;lt;br&amp;gt;&lt;br /&gt;
-• Which means if the key returned by llGetKey is &amp;quot;a2e76fcd-9360-4f6d-a924-000000000003&amp;quot;, then its email address is &amp;quot;a2e76fcd-9360-4f6d-a924-000000000003@lsl.secondlife.com&amp;quot;. &amp;lt;br&amp;gt;&lt;br /&gt;
-• Agents do not have fixed email addresses, use llInstantMessage or llOwnerSay.  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Prim2Prim Email&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
In LSL you can both send email with llEmail and receive it with the email event. &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
The email event is triggered with 5 pieces of information. &amp;lt;br&amp;gt;&lt;br /&gt;
• string 	time 	– 	When the message was sent, in the (string)llGetUnixTime format  &amp;lt;br&amp;gt;&lt;br /&gt;
• string 	address 	– 	Who sent the message 	 &amp;lt;br&amp;gt;&lt;br /&gt;
• string 	subject 	– 	Subject of the message 	 &amp;lt;br&amp;gt;&lt;br /&gt;
• string 	message 	– 	Body of the message 	 &amp;lt;br&amp;gt;&lt;br /&gt;
• integer 	num_left 	– 	The number of emails left in the email queue 	 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
When receiving a message sent with llEmail it helps to separate the message from the prefixed header. The header and original message body are separated by &amp;quot;\n\n&amp;quot;  &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
integer divide = llSubStringIndex(message, &amp;quot;\n\n&amp;quot;);&lt;br /&gt;
string header = llDeleteSubString(message, divide, -1);&lt;br /&gt;
message = llDeleteSubString(message, 0, divide + 1);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
To get just 1 of the header items, do this: &lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
list lines = llParseStringKeepNulls(header, [&amp;quot;\n&amp;quot;], []);&lt;br /&gt;
string objname_line = llList2String(lines, 0);&lt;br /&gt;
string region_line = llList2String(lines, 1);&lt;br /&gt;
string localpos_line = llList2String(lines, 2);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
To get a pure region name, do this: &lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
string region_name = llStringTrim(&lt;br /&gt;
            (string)llDeleteSubList(&lt;br /&gt;
                llParseStringKeepNulls(&lt;br /&gt;
                    llDeleteSubString(region_line, 0, 12),&lt;br /&gt;
                    [], &lt;br /&gt;
                    [&amp;quot;(&amp;quot;]&lt;br /&gt;
                ), -2, -1), STRING_TRIM);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This application uses email to have objects check with a central server to see if the owner has the latest version. In the objects: &lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
string version = &amp;quot;1&amp;quot;; //&lt;br /&gt;
string type = &amp;quot;lolcube&amp;quot;;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llEmail(&amp;quot;5a634b27-f032-283f-2df2-55ead7724b23@lsl.secondlife.com&amp;quot;,&lt;br /&gt;
            version,&lt;br /&gt;
            (string)llGetOwner() + &amp;quot;,&amp;quot; + type);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
The server: &lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSetTimerEvent(15.0);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    timer()&lt;br /&gt;
    {&lt;br /&gt;
        llGetNextEmail(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    email( string time, string address, string version, string message, integer num_left )&lt;br /&gt;
    {    &lt;br /&gt;
        if ((integer)version &amp;lt; 2)&lt;br /&gt;
        {&lt;br /&gt;
            list info = llCSV2List( llDeleteSubString(message, 0, llSubStringIndex(message, &amp;quot;\n\n&amp;quot;) + 1));&lt;br /&gt;
            llGiveInventory(llList2Key(info,0), llList2String(info,1));&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        if(num_left)&lt;br /&gt;
            llGetNextEmail(&amp;quot;&amp;quot;,&amp;quot;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
See Also &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Events&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
• [[email]]  &amp;lt;br&amp;gt;				&lt;br /&gt;
• [[link_message|link message]] 		 &amp;lt;br&amp;gt;		&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Functions&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
• [[llGetNextEmail]]  &amp;lt;br&amp;gt;				&lt;br /&gt;
• [[llMessageLinked]] 	 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Osgridadmin</name></author>
	</entry>
</feed>