llTargetedEmail

From Second Life Wiki
Jump to navigation Jump to search

Summary

Function: llTargetedEmail( integer target, string subject, string message );
20.0 Forced Delay
10.0 Energy

Sends an email to the owner (selected by target) of an object with subject and message.

• integer target
• string subject
• string message

The entire message (including the address, subject and other miscellaneous fields) can't be longer than 4096 bytes combined.

Specification

The target parameter selects which agent the email is sent to

Constant Val Select the email destination
TARGETED_EMAIL_OBJECT_OWNER 2 send email to the owner of the current object

The message is prefixed with information about the prim sending the email.

Template Example
Object-Name: *prim*
Region: *simname* (*simpos.x*, *simpos.y*)
Local-Position: (*primpos.x*, *primpos.y*, *primpos.z*)

*message*
Object-Name: Object
Region: Gibson (254976, 256000)
Local-Position: (117, 129, 50)

The real message starts here.

Caveats

  • This function causes the script to sleep for 20.0 seconds.
  • Originally this function was intended to enable sending email to either the object owner or creator; however, the ability to email creators was removed to avoid abuse scenarios.
  • There is a limit to the number of email messages an object can send in a given amount of time.
  • There is a limit of 500 messages from a single agent's objects in a one hour period.
  • The 4096 byte size limit includes the subject line and automatically added text. The practical maximum body size is approximately 3600 bytes.
  • (Sept-2008) The Email Throttle was modified slightly, Per Prospero Linden's comments: "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)."
  • Due to the 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 function for reliable inter-region messaging.
  • Due to the bug SVC-391 llEmail will silently fail (no mail will arrive) when non-ascii characters are present in the subject. However, non-ascii characters in the message body will be replaced by "?".

Examples

string emailSubject = "Someone touched me!";

default
{
    touch_start(integer num_detected)
    {
        // llSay(PUBLIC_CHANNEL, "Sending eMail report now, this will take ~20 seconds.");

        key id = llDetectedKey(0);
        string name = llDetectedName(0);

        llTargetedEmail(TARGETED_EMAIL_OBJECT_OWNER, emailSubject,
            "I was touched by: '" + name + "' (" + (string)id + ").");

        // llSay(PUBLIC_CHANNEL, "Email has been sent.");
    }
}

See Also

Functions

•  llEmail

Deep Notes

Signature

function void llTargetedEmail( integer target, string subject, string message );